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.

11753 lines
631 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /** @file
  2. * @brief MAVLink comm protocol testsuite generated from common.xml
  3. * @see http://qgroundcontrol.org/mavlink/
  4. */
  5. #pragma once
  6. #ifndef COMMON_TESTSUITE_H
  7. #define COMMON_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_all(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  15. {
  16. mavlink_test_common(system_id, component_id, last_msg);
  17. }
  18. #endif
  19. static void mavlink_test_heartbeat(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  20. {
  21. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  22. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  23. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_HEARTBEAT >= 256) {
  24. return;
  25. }
  26. #endif
  27. mavlink_message_t msg;
  28. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  29. uint16_t i;
  30. mavlink_heartbeat_t packet_in = {
  31. 963497464,17,84,151,218,3
  32. };
  33. mavlink_heartbeat_t packet1, packet2;
  34. memset(&packet1, 0, sizeof(packet1));
  35. packet1.custom_mode = packet_in.custom_mode;
  36. packet1.type = packet_in.type;
  37. packet1.autopilot = packet_in.autopilot;
  38. packet1.base_mode = packet_in.base_mode;
  39. packet1.system_status = packet_in.system_status;
  40. packet1.mavlink_version = packet_in.mavlink_version;
  41. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  42. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  43. // cope with extensions
  44. memset(MAVLINK_MSG_ID_HEARTBEAT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_HEARTBEAT_MIN_LEN);
  45. }
  46. #endif
  47. memset(&packet2, 0, sizeof(packet2));
  48. mavlink_msg_heartbeat_encode(system_id, component_id, &msg, &packet1);
  49. mavlink_msg_heartbeat_decode(&msg, &packet2);
  50. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  51. memset(&packet2, 0, sizeof(packet2));
  52. mavlink_msg_heartbeat_pack(system_id, component_id, &msg , packet1.type , packet1.autopilot , packet1.base_mode , packet1.custom_mode , packet1.system_status );
  53. mavlink_msg_heartbeat_decode(&msg, &packet2);
  54. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  55. memset(&packet2, 0, sizeof(packet2));
  56. mavlink_msg_heartbeat_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.type , packet1.autopilot , packet1.base_mode , packet1.custom_mode , packet1.system_status );
  57. mavlink_msg_heartbeat_decode(&msg, &packet2);
  58. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  59. memset(&packet2, 0, sizeof(packet2));
  60. mavlink_msg_to_send_buffer(buffer, &msg);
  61. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  62. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  63. }
  64. mavlink_msg_heartbeat_decode(last_msg, &packet2);
  65. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  66. memset(&packet2, 0, sizeof(packet2));
  67. mavlink_msg_heartbeat_send(MAVLINK_COMM_1 , packet1.type , packet1.autopilot , packet1.base_mode , packet1.custom_mode , packet1.system_status );
  68. mavlink_msg_heartbeat_decode(last_msg, &packet2);
  69. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  70. }
  71. static void mavlink_test_sys_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  72. {
  73. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  74. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  75. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SYS_STATUS >= 256) {
  76. return;
  77. }
  78. #endif
  79. mavlink_message_t msg;
  80. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  81. uint16_t i;
  82. mavlink_sys_status_t packet_in = {
  83. 963497464,963497672,963497880,17859,17963,18067,18171,18275,18379,18483,18587,18691,223
  84. };
  85. mavlink_sys_status_t packet1, packet2;
  86. memset(&packet1, 0, sizeof(packet1));
  87. packet1.onboard_control_sensors_present = packet_in.onboard_control_sensors_present;
  88. packet1.onboard_control_sensors_enabled = packet_in.onboard_control_sensors_enabled;
  89. packet1.onboard_control_sensors_health = packet_in.onboard_control_sensors_health;
  90. packet1.load = packet_in.load;
  91. packet1.voltage_battery = packet_in.voltage_battery;
  92. packet1.current_battery = packet_in.current_battery;
  93. packet1.drop_rate_comm = packet_in.drop_rate_comm;
  94. packet1.errors_comm = packet_in.errors_comm;
  95. packet1.errors_count1 = packet_in.errors_count1;
  96. packet1.errors_count2 = packet_in.errors_count2;
  97. packet1.errors_count3 = packet_in.errors_count3;
  98. packet1.errors_count4 = packet_in.errors_count4;
  99. packet1.battery_remaining = packet_in.battery_remaining;
  100. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  101. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  102. // cope with extensions
  103. memset(MAVLINK_MSG_ID_SYS_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SYS_STATUS_MIN_LEN);
  104. }
  105. #endif
  106. memset(&packet2, 0, sizeof(packet2));
  107. mavlink_msg_sys_status_encode(system_id, component_id, &msg, &packet1);
  108. mavlink_msg_sys_status_decode(&msg, &packet2);
  109. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  110. memset(&packet2, 0, sizeof(packet2));
  111. mavlink_msg_sys_status_pack(system_id, component_id, &msg , packet1.onboard_control_sensors_present , packet1.onboard_control_sensors_enabled , packet1.onboard_control_sensors_health , packet1.load , packet1.voltage_battery , packet1.current_battery , packet1.battery_remaining , packet1.drop_rate_comm , packet1.errors_comm , packet1.errors_count1 , packet1.errors_count2 , packet1.errors_count3 , packet1.errors_count4 );
  112. mavlink_msg_sys_status_decode(&msg, &packet2);
  113. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  114. memset(&packet2, 0, sizeof(packet2));
  115. mavlink_msg_sys_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.onboard_control_sensors_present , packet1.onboard_control_sensors_enabled , packet1.onboard_control_sensors_health , packet1.load , packet1.voltage_battery , packet1.current_battery , packet1.battery_remaining , packet1.drop_rate_comm , packet1.errors_comm , packet1.errors_count1 , packet1.errors_count2 , packet1.errors_count3 , packet1.errors_count4 );
  116. mavlink_msg_sys_status_decode(&msg, &packet2);
  117. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  118. memset(&packet2, 0, sizeof(packet2));
  119. mavlink_msg_to_send_buffer(buffer, &msg);
  120. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  121. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  122. }
  123. mavlink_msg_sys_status_decode(last_msg, &packet2);
  124. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  125. memset(&packet2, 0, sizeof(packet2));
  126. mavlink_msg_sys_status_send(MAVLINK_COMM_1 , packet1.onboard_control_sensors_present , packet1.onboard_control_sensors_enabled , packet1.onboard_control_sensors_health , packet1.load , packet1.voltage_battery , packet1.current_battery , packet1.battery_remaining , packet1.drop_rate_comm , packet1.errors_comm , packet1.errors_count1 , packet1.errors_count2 , packet1.errors_count3 , packet1.errors_count4 );
  127. mavlink_msg_sys_status_decode(last_msg, &packet2);
  128. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  129. }
  130. static void mavlink_test_system_time(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  131. {
  132. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  133. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  134. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SYSTEM_TIME >= 256) {
  135. return;
  136. }
  137. #endif
  138. mavlink_message_t msg;
  139. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  140. uint16_t i;
  141. mavlink_system_time_t packet_in = {
  142. 93372036854775807ULL,963497880
  143. };
  144. mavlink_system_time_t packet1, packet2;
  145. memset(&packet1, 0, sizeof(packet1));
  146. packet1.time_unix_usec = packet_in.time_unix_usec;
  147. packet1.time_boot_ms = packet_in.time_boot_ms;
  148. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  149. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  150. // cope with extensions
  151. memset(MAVLINK_MSG_ID_SYSTEM_TIME_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SYSTEM_TIME_MIN_LEN);
  152. }
  153. #endif
  154. memset(&packet2, 0, sizeof(packet2));
  155. mavlink_msg_system_time_encode(system_id, component_id, &msg, &packet1);
  156. mavlink_msg_system_time_decode(&msg, &packet2);
  157. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  158. memset(&packet2, 0, sizeof(packet2));
  159. mavlink_msg_system_time_pack(system_id, component_id, &msg , packet1.time_unix_usec , packet1.time_boot_ms );
  160. mavlink_msg_system_time_decode(&msg, &packet2);
  161. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  162. memset(&packet2, 0, sizeof(packet2));
  163. mavlink_msg_system_time_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_unix_usec , packet1.time_boot_ms );
  164. mavlink_msg_system_time_decode(&msg, &packet2);
  165. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  166. memset(&packet2, 0, sizeof(packet2));
  167. mavlink_msg_to_send_buffer(buffer, &msg);
  168. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  169. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  170. }
  171. mavlink_msg_system_time_decode(last_msg, &packet2);
  172. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  173. memset(&packet2, 0, sizeof(packet2));
  174. mavlink_msg_system_time_send(MAVLINK_COMM_1 , packet1.time_unix_usec , packet1.time_boot_ms );
  175. mavlink_msg_system_time_decode(last_msg, &packet2);
  176. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  177. }
  178. static void mavlink_test_ping(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  179. {
  180. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  181. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  182. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_PING >= 256) {
  183. return;
  184. }
  185. #endif
  186. mavlink_message_t msg;
  187. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  188. uint16_t i;
  189. mavlink_ping_t packet_in = {
  190. 93372036854775807ULL,963497880,41,108
  191. };
  192. mavlink_ping_t packet1, packet2;
  193. memset(&packet1, 0, sizeof(packet1));
  194. packet1.time_usec = packet_in.time_usec;
  195. packet1.seq = packet_in.seq;
  196. packet1.target_system = packet_in.target_system;
  197. packet1.target_component = packet_in.target_component;
  198. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  199. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  200. // cope with extensions
  201. memset(MAVLINK_MSG_ID_PING_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_PING_MIN_LEN);
  202. }
  203. #endif
  204. memset(&packet2, 0, sizeof(packet2));
  205. mavlink_msg_ping_encode(system_id, component_id, &msg, &packet1);
  206. mavlink_msg_ping_decode(&msg, &packet2);
  207. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  208. memset(&packet2, 0, sizeof(packet2));
  209. mavlink_msg_ping_pack(system_id, component_id, &msg , packet1.time_usec , packet1.seq , packet1.target_system , packet1.target_component );
  210. mavlink_msg_ping_decode(&msg, &packet2);
  211. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  212. memset(&packet2, 0, sizeof(packet2));
  213. mavlink_msg_ping_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.seq , packet1.target_system , packet1.target_component );
  214. mavlink_msg_ping_decode(&msg, &packet2);
  215. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  216. memset(&packet2, 0, sizeof(packet2));
  217. mavlink_msg_to_send_buffer(buffer, &msg);
  218. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  219. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  220. }
  221. mavlink_msg_ping_decode(last_msg, &packet2);
  222. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  223. memset(&packet2, 0, sizeof(packet2));
  224. mavlink_msg_ping_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.seq , packet1.target_system , packet1.target_component );
  225. mavlink_msg_ping_decode(last_msg, &packet2);
  226. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  227. }
  228. static void mavlink_test_change_operator_control(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  229. {
  230. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  231. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  232. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL >= 256) {
  233. return;
  234. }
  235. #endif
  236. mavlink_message_t msg;
  237. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  238. uint16_t i;
  239. mavlink_change_operator_control_t packet_in = {
  240. 5,72,139,"DEFGHIJKLMNOPQRSTUVWXYZA"
  241. };
  242. mavlink_change_operator_control_t packet1, packet2;
  243. memset(&packet1, 0, sizeof(packet1));
  244. packet1.target_system = packet_in.target_system;
  245. packet1.control_request = packet_in.control_request;
  246. packet1.version = packet_in.version;
  247. mav_array_memcpy(packet1.passkey, packet_in.passkey, sizeof(char)*25);
  248. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  249. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  250. // cope with extensions
  251. memset(MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_MIN_LEN);
  252. }
  253. #endif
  254. memset(&packet2, 0, sizeof(packet2));
  255. mavlink_msg_change_operator_control_encode(system_id, component_id, &msg, &packet1);
  256. mavlink_msg_change_operator_control_decode(&msg, &packet2);
  257. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  258. memset(&packet2, 0, sizeof(packet2));
  259. mavlink_msg_change_operator_control_pack(system_id, component_id, &msg , packet1.target_system , packet1.control_request , packet1.version , packet1.passkey );
  260. mavlink_msg_change_operator_control_decode(&msg, &packet2);
  261. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  262. memset(&packet2, 0, sizeof(packet2));
  263. mavlink_msg_change_operator_control_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.control_request , packet1.version , packet1.passkey );
  264. mavlink_msg_change_operator_control_decode(&msg, &packet2);
  265. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  266. memset(&packet2, 0, sizeof(packet2));
  267. mavlink_msg_to_send_buffer(buffer, &msg);
  268. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  269. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  270. }
  271. mavlink_msg_change_operator_control_decode(last_msg, &packet2);
  272. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  273. memset(&packet2, 0, sizeof(packet2));
  274. mavlink_msg_change_operator_control_send(MAVLINK_COMM_1 , packet1.target_system , packet1.control_request , packet1.version , packet1.passkey );
  275. mavlink_msg_change_operator_control_decode(last_msg, &packet2);
  276. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  277. }
  278. static void mavlink_test_change_operator_control_ack(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  279. {
  280. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  281. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  282. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK >= 256) {
  283. return;
  284. }
  285. #endif
  286. mavlink_message_t msg;
  287. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  288. uint16_t i;
  289. mavlink_change_operator_control_ack_t packet_in = {
  290. 5,72,139
  291. };
  292. mavlink_change_operator_control_ack_t packet1, packet2;
  293. memset(&packet1, 0, sizeof(packet1));
  294. packet1.gcs_system_id = packet_in.gcs_system_id;
  295. packet1.control_request = packet_in.control_request;
  296. packet1.ack = packet_in.ack;
  297. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  298. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  299. // cope with extensions
  300. memset(MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_MIN_LEN);
  301. }
  302. #endif
  303. memset(&packet2, 0, sizeof(packet2));
  304. mavlink_msg_change_operator_control_ack_encode(system_id, component_id, &msg, &packet1);
  305. mavlink_msg_change_operator_control_ack_decode(&msg, &packet2);
  306. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  307. memset(&packet2, 0, sizeof(packet2));
  308. mavlink_msg_change_operator_control_ack_pack(system_id, component_id, &msg , packet1.gcs_system_id , packet1.control_request , packet1.ack );
  309. mavlink_msg_change_operator_control_ack_decode(&msg, &packet2);
  310. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  311. memset(&packet2, 0, sizeof(packet2));
  312. mavlink_msg_change_operator_control_ack_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.gcs_system_id , packet1.control_request , packet1.ack );
  313. mavlink_msg_change_operator_control_ack_decode(&msg, &packet2);
  314. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  315. memset(&packet2, 0, sizeof(packet2));
  316. mavlink_msg_to_send_buffer(buffer, &msg);
  317. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  318. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  319. }
  320. mavlink_msg_change_operator_control_ack_decode(last_msg, &packet2);
  321. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  322. memset(&packet2, 0, sizeof(packet2));
  323. mavlink_msg_change_operator_control_ack_send(MAVLINK_COMM_1 , packet1.gcs_system_id , packet1.control_request , packet1.ack );
  324. mavlink_msg_change_operator_control_ack_decode(last_msg, &packet2);
  325. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  326. }
  327. static void mavlink_test_auth_key(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  328. {
  329. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  330. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  331. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_AUTH_KEY >= 256) {
  332. return;
  333. }
  334. #endif
  335. mavlink_message_t msg;
  336. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  337. uint16_t i;
  338. mavlink_auth_key_t packet_in = {
  339. "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDE"
  340. };
  341. mavlink_auth_key_t packet1, packet2;
  342. memset(&packet1, 0, sizeof(packet1));
  343. mav_array_memcpy(packet1.key, packet_in.key, sizeof(char)*32);
  344. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  345. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  346. // cope with extensions
  347. memset(MAVLINK_MSG_ID_AUTH_KEY_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_AUTH_KEY_MIN_LEN);
  348. }
  349. #endif
  350. memset(&packet2, 0, sizeof(packet2));
  351. mavlink_msg_auth_key_encode(system_id, component_id, &msg, &packet1);
  352. mavlink_msg_auth_key_decode(&msg, &packet2);
  353. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  354. memset(&packet2, 0, sizeof(packet2));
  355. mavlink_msg_auth_key_pack(system_id, component_id, &msg , packet1.key );
  356. mavlink_msg_auth_key_decode(&msg, &packet2);
  357. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  358. memset(&packet2, 0, sizeof(packet2));
  359. mavlink_msg_auth_key_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.key );
  360. mavlink_msg_auth_key_decode(&msg, &packet2);
  361. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  362. memset(&packet2, 0, sizeof(packet2));
  363. mavlink_msg_to_send_buffer(buffer, &msg);
  364. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  365. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  366. }
  367. mavlink_msg_auth_key_decode(last_msg, &packet2);
  368. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  369. memset(&packet2, 0, sizeof(packet2));
  370. mavlink_msg_auth_key_send(MAVLINK_COMM_1 , packet1.key );
  371. mavlink_msg_auth_key_decode(last_msg, &packet2);
  372. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  373. }
  374. static void mavlink_test_link_node_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  375. {
  376. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  377. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  378. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_LINK_NODE_STATUS >= 256) {
  379. return;
  380. }
  381. #endif
  382. mavlink_message_t msg;
  383. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  384. uint16_t i;
  385. mavlink_link_node_status_t packet_in = {
  386. 93372036854775807ULL,963497880,963498088,963498296,963498504,963498712,18691,18795,18899,235,46
  387. };
  388. mavlink_link_node_status_t packet1, packet2;
  389. memset(&packet1, 0, sizeof(packet1));
  390. packet1.timestamp = packet_in.timestamp;
  391. packet1.tx_rate = packet_in.tx_rate;
  392. packet1.rx_rate = packet_in.rx_rate;
  393. packet1.messages_sent = packet_in.messages_sent;
  394. packet1.messages_received = packet_in.messages_received;
  395. packet1.messages_lost = packet_in.messages_lost;
  396. packet1.rx_parse_err = packet_in.rx_parse_err;
  397. packet1.tx_overflows = packet_in.tx_overflows;
  398. packet1.rx_overflows = packet_in.rx_overflows;
  399. packet1.tx_buf = packet_in.tx_buf;
  400. packet1.rx_buf = packet_in.rx_buf;
  401. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  402. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  403. // cope with extensions
  404. memset(MAVLINK_MSG_ID_LINK_NODE_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_LINK_NODE_STATUS_MIN_LEN);
  405. }
  406. #endif
  407. memset(&packet2, 0, sizeof(packet2));
  408. mavlink_msg_link_node_status_encode(system_id, component_id, &msg, &packet1);
  409. mavlink_msg_link_node_status_decode(&msg, &packet2);
  410. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  411. memset(&packet2, 0, sizeof(packet2));
  412. mavlink_msg_link_node_status_pack(system_id, component_id, &msg , packet1.timestamp , packet1.tx_buf , packet1.rx_buf , packet1.tx_rate , packet1.rx_rate , packet1.rx_parse_err , packet1.tx_overflows , packet1.rx_overflows , packet1.messages_sent , packet1.messages_received , packet1.messages_lost );
  413. mavlink_msg_link_node_status_decode(&msg, &packet2);
  414. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  415. memset(&packet2, 0, sizeof(packet2));
  416. mavlink_msg_link_node_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.timestamp , packet1.tx_buf , packet1.rx_buf , packet1.tx_rate , packet1.rx_rate , packet1.rx_parse_err , packet1.tx_overflows , packet1.rx_overflows , packet1.messages_sent , packet1.messages_received , packet1.messages_lost );
  417. mavlink_msg_link_node_status_decode(&msg, &packet2);
  418. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  419. memset(&packet2, 0, sizeof(packet2));
  420. mavlink_msg_to_send_buffer(buffer, &msg);
  421. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  422. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  423. }
  424. mavlink_msg_link_node_status_decode(last_msg, &packet2);
  425. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  426. memset(&packet2, 0, sizeof(packet2));
  427. mavlink_msg_link_node_status_send(MAVLINK_COMM_1 , packet1.timestamp , packet1.tx_buf , packet1.rx_buf , packet1.tx_rate , packet1.rx_rate , packet1.rx_parse_err , packet1.tx_overflows , packet1.rx_overflows , packet1.messages_sent , packet1.messages_received , packet1.messages_lost );
  428. mavlink_msg_link_node_status_decode(last_msg, &packet2);
  429. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  430. }
  431. static void mavlink_test_set_mode(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  432. {
  433. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  434. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  435. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SET_MODE >= 256) {
  436. return;
  437. }
  438. #endif
  439. mavlink_message_t msg;
  440. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  441. uint16_t i;
  442. mavlink_set_mode_t packet_in = {
  443. 963497464,17,84
  444. };
  445. mavlink_set_mode_t packet1, packet2;
  446. memset(&packet1, 0, sizeof(packet1));
  447. packet1.custom_mode = packet_in.custom_mode;
  448. packet1.target_system = packet_in.target_system;
  449. packet1.base_mode = packet_in.base_mode;
  450. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  451. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  452. // cope with extensions
  453. memset(MAVLINK_MSG_ID_SET_MODE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SET_MODE_MIN_LEN);
  454. }
  455. #endif
  456. memset(&packet2, 0, sizeof(packet2));
  457. mavlink_msg_set_mode_encode(system_id, component_id, &msg, &packet1);
  458. mavlink_msg_set_mode_decode(&msg, &packet2);
  459. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  460. memset(&packet2, 0, sizeof(packet2));
  461. mavlink_msg_set_mode_pack(system_id, component_id, &msg , packet1.target_system , packet1.base_mode , packet1.custom_mode );
  462. mavlink_msg_set_mode_decode(&msg, &packet2);
  463. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  464. memset(&packet2, 0, sizeof(packet2));
  465. mavlink_msg_set_mode_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.base_mode , packet1.custom_mode );
  466. mavlink_msg_set_mode_decode(&msg, &packet2);
  467. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  468. memset(&packet2, 0, sizeof(packet2));
  469. mavlink_msg_to_send_buffer(buffer, &msg);
  470. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  471. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  472. }
  473. mavlink_msg_set_mode_decode(last_msg, &packet2);
  474. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  475. memset(&packet2, 0, sizeof(packet2));
  476. mavlink_msg_set_mode_send(MAVLINK_COMM_1 , packet1.target_system , packet1.base_mode , packet1.custom_mode );
  477. mavlink_msg_set_mode_decode(last_msg, &packet2);
  478. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  479. }
  480. static void mavlink_test_param_request_read(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  481. {
  482. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  483. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  484. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_PARAM_REQUEST_READ >= 256) {
  485. return;
  486. }
  487. #endif
  488. mavlink_message_t msg;
  489. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  490. uint16_t i;
  491. mavlink_param_request_read_t packet_in = {
  492. 17235,139,206,"EFGHIJKLMNOPQRS"
  493. };
  494. mavlink_param_request_read_t packet1, packet2;
  495. memset(&packet1, 0, sizeof(packet1));
  496. packet1.param_index = packet_in.param_index;
  497. packet1.target_system = packet_in.target_system;
  498. packet1.target_component = packet_in.target_component;
  499. mav_array_memcpy(packet1.param_id, packet_in.param_id, sizeof(char)*16);
  500. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  501. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  502. // cope with extensions
  503. memset(MAVLINK_MSG_ID_PARAM_REQUEST_READ_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_PARAM_REQUEST_READ_MIN_LEN);
  504. }
  505. #endif
  506. memset(&packet2, 0, sizeof(packet2));
  507. mavlink_msg_param_request_read_encode(system_id, component_id, &msg, &packet1);
  508. mavlink_msg_param_request_read_decode(&msg, &packet2);
  509. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  510. memset(&packet2, 0, sizeof(packet2));
  511. mavlink_msg_param_request_read_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.param_id , packet1.param_index );
  512. mavlink_msg_param_request_read_decode(&msg, &packet2);
  513. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  514. memset(&packet2, 0, sizeof(packet2));
  515. mavlink_msg_param_request_read_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.param_id , packet1.param_index );
  516. mavlink_msg_param_request_read_decode(&msg, &packet2);
  517. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  518. memset(&packet2, 0, sizeof(packet2));
  519. mavlink_msg_to_send_buffer(buffer, &msg);
  520. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  521. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  522. }
  523. mavlink_msg_param_request_read_decode(last_msg, &packet2);
  524. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  525. memset(&packet2, 0, sizeof(packet2));
  526. mavlink_msg_param_request_read_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.param_id , packet1.param_index );
  527. mavlink_msg_param_request_read_decode(last_msg, &packet2);
  528. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  529. }
  530. static void mavlink_test_param_request_list(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  531. {
  532. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  533. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  534. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_PARAM_REQUEST_LIST >= 256) {
  535. return;
  536. }
  537. #endif
  538. mavlink_message_t msg;
  539. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  540. uint16_t i;
  541. mavlink_param_request_list_t packet_in = {
  542. 5,72
  543. };
  544. mavlink_param_request_list_t packet1, packet2;
  545. memset(&packet1, 0, sizeof(packet1));
  546. packet1.target_system = packet_in.target_system;
  547. packet1.target_component = packet_in.target_component;
  548. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  549. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  550. // cope with extensions
  551. memset(MAVLINK_MSG_ID_PARAM_REQUEST_LIST_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_PARAM_REQUEST_LIST_MIN_LEN);
  552. }
  553. #endif
  554. memset(&packet2, 0, sizeof(packet2));
  555. mavlink_msg_param_request_list_encode(system_id, component_id, &msg, &packet1);
  556. mavlink_msg_param_request_list_decode(&msg, &packet2);
  557. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  558. memset(&packet2, 0, sizeof(packet2));
  559. mavlink_msg_param_request_list_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component );
  560. mavlink_msg_param_request_list_decode(&msg, &packet2);
  561. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  562. memset(&packet2, 0, sizeof(packet2));
  563. mavlink_msg_param_request_list_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component );
  564. mavlink_msg_param_request_list_decode(&msg, &packet2);
  565. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  566. memset(&packet2, 0, sizeof(packet2));
  567. mavlink_msg_to_send_buffer(buffer, &msg);
  568. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  569. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  570. }
  571. mavlink_msg_param_request_list_decode(last_msg, &packet2);
  572. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  573. memset(&packet2, 0, sizeof(packet2));
  574. mavlink_msg_param_request_list_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component );
  575. mavlink_msg_param_request_list_decode(last_msg, &packet2);
  576. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  577. }
  578. static void mavlink_test_param_value(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  579. {
  580. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  581. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  582. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_PARAM_VALUE >= 256) {
  583. return;
  584. }
  585. #endif
  586. mavlink_message_t msg;
  587. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  588. uint16_t i;
  589. mavlink_param_value_t packet_in = {
  590. 17.0,17443,17547,"IJKLMNOPQRSTUVW",77
  591. };
  592. mavlink_param_value_t packet1, packet2;
  593. memset(&packet1, 0, sizeof(packet1));
  594. packet1.param_value = packet_in.param_value;
  595. packet1.param_count = packet_in.param_count;
  596. packet1.param_index = packet_in.param_index;
  597. packet1.param_type = packet_in.param_type;
  598. mav_array_memcpy(packet1.param_id, packet_in.param_id, sizeof(char)*16);
  599. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  600. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  601. // cope with extensions
  602. memset(MAVLINK_MSG_ID_PARAM_VALUE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_PARAM_VALUE_MIN_LEN);
  603. }
  604. #endif
  605. memset(&packet2, 0, sizeof(packet2));
  606. mavlink_msg_param_value_encode(system_id, component_id, &msg, &packet1);
  607. mavlink_msg_param_value_decode(&msg, &packet2);
  608. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  609. memset(&packet2, 0, sizeof(packet2));
  610. mavlink_msg_param_value_pack(system_id, component_id, &msg , packet1.param_id , packet1.param_value , packet1.param_type , packet1.param_count , packet1.param_index );
  611. mavlink_msg_param_value_decode(&msg, &packet2);
  612. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  613. memset(&packet2, 0, sizeof(packet2));
  614. mavlink_msg_param_value_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.param_id , packet1.param_value , packet1.param_type , packet1.param_count , packet1.param_index );
  615. mavlink_msg_param_value_decode(&msg, &packet2);
  616. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  617. memset(&packet2, 0, sizeof(packet2));
  618. mavlink_msg_to_send_buffer(buffer, &msg);
  619. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  620. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  621. }
  622. mavlink_msg_param_value_decode(last_msg, &packet2);
  623. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  624. memset(&packet2, 0, sizeof(packet2));
  625. mavlink_msg_param_value_send(MAVLINK_COMM_1 , packet1.param_id , packet1.param_value , packet1.param_type , packet1.param_count , packet1.param_index );
  626. mavlink_msg_param_value_decode(last_msg, &packet2);
  627. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  628. }
  629. static void mavlink_test_param_set(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  630. {
  631. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  632. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  633. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_PARAM_SET >= 256) {
  634. return;
  635. }
  636. #endif
  637. mavlink_message_t msg;
  638. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  639. uint16_t i;
  640. mavlink_param_set_t packet_in = {
  641. 17.0,17,84,"GHIJKLMNOPQRSTU",199
  642. };
  643. mavlink_param_set_t packet1, packet2;
  644. memset(&packet1, 0, sizeof(packet1));
  645. packet1.param_value = packet_in.param_value;
  646. packet1.target_system = packet_in.target_system;
  647. packet1.target_component = packet_in.target_component;
  648. packet1.param_type = packet_in.param_type;
  649. mav_array_memcpy(packet1.param_id, packet_in.param_id, sizeof(char)*16);
  650. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  651. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  652. // cope with extensions
  653. memset(MAVLINK_MSG_ID_PARAM_SET_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_PARAM_SET_MIN_LEN);
  654. }
  655. #endif
  656. memset(&packet2, 0, sizeof(packet2));
  657. mavlink_msg_param_set_encode(system_id, component_id, &msg, &packet1);
  658. mavlink_msg_param_set_decode(&msg, &packet2);
  659. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  660. memset(&packet2, 0, sizeof(packet2));
  661. mavlink_msg_param_set_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.param_id , packet1.param_value , packet1.param_type );
  662. mavlink_msg_param_set_decode(&msg, &packet2);
  663. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  664. memset(&packet2, 0, sizeof(packet2));
  665. mavlink_msg_param_set_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.param_id , packet1.param_value , packet1.param_type );
  666. mavlink_msg_param_set_decode(&msg, &packet2);
  667. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  668. memset(&packet2, 0, sizeof(packet2));
  669. mavlink_msg_to_send_buffer(buffer, &msg);
  670. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  671. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  672. }
  673. mavlink_msg_param_set_decode(last_msg, &packet2);
  674. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  675. memset(&packet2, 0, sizeof(packet2));
  676. mavlink_msg_param_set_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.param_id , packet1.param_value , packet1.param_type );
  677. mavlink_msg_param_set_decode(last_msg, &packet2);
  678. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  679. }
  680. static void mavlink_test_gps_raw_int(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  681. {
  682. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  683. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  684. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GPS_RAW_INT >= 256) {
  685. return;
  686. }
  687. #endif
  688. mavlink_message_t msg;
  689. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  690. uint16_t i;
  691. mavlink_gps_raw_int_t packet_in = {
  692. 93372036854775807ULL,963497880,963498088,963498296,18275,18379,18483,18587,89,156,963499024,963499232,963499440,963499648,963499856
  693. };
  694. mavlink_gps_raw_int_t packet1, packet2;
  695. memset(&packet1, 0, sizeof(packet1));
  696. packet1.time_usec = packet_in.time_usec;
  697. packet1.lat = packet_in.lat;
  698. packet1.lon = packet_in.lon;
  699. packet1.alt = packet_in.alt;
  700. packet1.eph = packet_in.eph;
  701. packet1.epv = packet_in.epv;
  702. packet1.vel = packet_in.vel;
  703. packet1.cog = packet_in.cog;
  704. packet1.fix_type = packet_in.fix_type;
  705. packet1.satellites_visible = packet_in.satellites_visible;
  706. packet1.alt_ellipsoid = packet_in.alt_ellipsoid;
  707. packet1.h_acc = packet_in.h_acc;
  708. packet1.v_acc = packet_in.v_acc;
  709. packet1.vel_acc = packet_in.vel_acc;
  710. packet1.hdg_acc = packet_in.hdg_acc;
  711. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  712. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  713. // cope with extensions
  714. memset(MAVLINK_MSG_ID_GPS_RAW_INT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GPS_RAW_INT_MIN_LEN);
  715. }
  716. #endif
  717. memset(&packet2, 0, sizeof(packet2));
  718. mavlink_msg_gps_raw_int_encode(system_id, component_id, &msg, &packet1);
  719. mavlink_msg_gps_raw_int_decode(&msg, &packet2);
  720. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  721. memset(&packet2, 0, sizeof(packet2));
  722. mavlink_msg_gps_raw_int_pack(system_id, component_id, &msg , packet1.time_usec , packet1.fix_type , packet1.lat , packet1.lon , packet1.alt , packet1.eph , packet1.epv , packet1.vel , packet1.cog , packet1.satellites_visible , packet1.alt_ellipsoid , packet1.h_acc , packet1.v_acc , packet1.vel_acc , packet1.hdg_acc );
  723. mavlink_msg_gps_raw_int_decode(&msg, &packet2);
  724. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  725. memset(&packet2, 0, sizeof(packet2));
  726. mavlink_msg_gps_raw_int_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.fix_type , packet1.lat , packet1.lon , packet1.alt , packet1.eph , packet1.epv , packet1.vel , packet1.cog , packet1.satellites_visible , packet1.alt_ellipsoid , packet1.h_acc , packet1.v_acc , packet1.vel_acc , packet1.hdg_acc );
  727. mavlink_msg_gps_raw_int_decode(&msg, &packet2);
  728. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  729. memset(&packet2, 0, sizeof(packet2));
  730. mavlink_msg_to_send_buffer(buffer, &msg);
  731. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  732. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  733. }
  734. mavlink_msg_gps_raw_int_decode(last_msg, &packet2);
  735. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  736. memset(&packet2, 0, sizeof(packet2));
  737. mavlink_msg_gps_raw_int_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.fix_type , packet1.lat , packet1.lon , packet1.alt , packet1.eph , packet1.epv , packet1.vel , packet1.cog , packet1.satellites_visible , packet1.alt_ellipsoid , packet1.h_acc , packet1.v_acc , packet1.vel_acc , packet1.hdg_acc );
  738. mavlink_msg_gps_raw_int_decode(last_msg, &packet2);
  739. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  740. }
  741. static void mavlink_test_gps_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  742. {
  743. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  744. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  745. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GPS_STATUS >= 256) {
  746. return;
  747. }
  748. #endif
  749. mavlink_message_t msg;
  750. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  751. uint16_t i;
  752. mavlink_gps_status_t packet_in = {
  753. 5,{ 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91 },{ 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151 },{ 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211 },{ 252, 253, 254, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },{ 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75 }
  754. };
  755. mavlink_gps_status_t packet1, packet2;
  756. memset(&packet1, 0, sizeof(packet1));
  757. packet1.satellites_visible = packet_in.satellites_visible;
  758. mav_array_memcpy(packet1.satellite_prn, packet_in.satellite_prn, sizeof(uint8_t)*20);
  759. mav_array_memcpy(packet1.satellite_used, packet_in.satellite_used, sizeof(uint8_t)*20);
  760. mav_array_memcpy(packet1.satellite_elevation, packet_in.satellite_elevation, sizeof(uint8_t)*20);
  761. mav_array_memcpy(packet1.satellite_azimuth, packet_in.satellite_azimuth, sizeof(uint8_t)*20);
  762. mav_array_memcpy(packet1.satellite_snr, packet_in.satellite_snr, sizeof(uint8_t)*20);
  763. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  764. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  765. // cope with extensions
  766. memset(MAVLINK_MSG_ID_GPS_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GPS_STATUS_MIN_LEN);
  767. }
  768. #endif
  769. memset(&packet2, 0, sizeof(packet2));
  770. mavlink_msg_gps_status_encode(system_id, component_id, &msg, &packet1);
  771. mavlink_msg_gps_status_decode(&msg, &packet2);
  772. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  773. memset(&packet2, 0, sizeof(packet2));
  774. mavlink_msg_gps_status_pack(system_id, component_id, &msg , packet1.satellites_visible , packet1.satellite_prn , packet1.satellite_used , packet1.satellite_elevation , packet1.satellite_azimuth , packet1.satellite_snr );
  775. mavlink_msg_gps_status_decode(&msg, &packet2);
  776. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  777. memset(&packet2, 0, sizeof(packet2));
  778. mavlink_msg_gps_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.satellites_visible , packet1.satellite_prn , packet1.satellite_used , packet1.satellite_elevation , packet1.satellite_azimuth , packet1.satellite_snr );
  779. mavlink_msg_gps_status_decode(&msg, &packet2);
  780. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  781. memset(&packet2, 0, sizeof(packet2));
  782. mavlink_msg_to_send_buffer(buffer, &msg);
  783. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  784. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  785. }
  786. mavlink_msg_gps_status_decode(last_msg, &packet2);
  787. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  788. memset(&packet2, 0, sizeof(packet2));
  789. mavlink_msg_gps_status_send(MAVLINK_COMM_1 , packet1.satellites_visible , packet1.satellite_prn , packet1.satellite_used , packet1.satellite_elevation , packet1.satellite_azimuth , packet1.satellite_snr );
  790. mavlink_msg_gps_status_decode(last_msg, &packet2);
  791. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  792. }
  793. static void mavlink_test_scaled_imu(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  794. {
  795. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  796. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  797. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SCALED_IMU >= 256) {
  798. return;
  799. }
  800. #endif
  801. mavlink_message_t msg;
  802. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  803. uint16_t i;
  804. mavlink_scaled_imu_t packet_in = {
  805. 963497464,17443,17547,17651,17755,17859,17963,18067,18171,18275,18379
  806. };
  807. mavlink_scaled_imu_t packet1, packet2;
  808. memset(&packet1, 0, sizeof(packet1));
  809. packet1.time_boot_ms = packet_in.time_boot_ms;
  810. packet1.xacc = packet_in.xacc;
  811. packet1.yacc = packet_in.yacc;
  812. packet1.zacc = packet_in.zacc;
  813. packet1.xgyro = packet_in.xgyro;
  814. packet1.ygyro = packet_in.ygyro;
  815. packet1.zgyro = packet_in.zgyro;
  816. packet1.xmag = packet_in.xmag;
  817. packet1.ymag = packet_in.ymag;
  818. packet1.zmag = packet_in.zmag;
  819. packet1.temperature = packet_in.temperature;
  820. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  821. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  822. // cope with extensions
  823. memset(MAVLINK_MSG_ID_SCALED_IMU_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SCALED_IMU_MIN_LEN);
  824. }
  825. #endif
  826. memset(&packet2, 0, sizeof(packet2));
  827. mavlink_msg_scaled_imu_encode(system_id, component_id, &msg, &packet1);
  828. mavlink_msg_scaled_imu_decode(&msg, &packet2);
  829. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  830. memset(&packet2, 0, sizeof(packet2));
  831. mavlink_msg_scaled_imu_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag , packet1.temperature );
  832. mavlink_msg_scaled_imu_decode(&msg, &packet2);
  833. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  834. memset(&packet2, 0, sizeof(packet2));
  835. mavlink_msg_scaled_imu_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag , packet1.temperature );
  836. mavlink_msg_scaled_imu_decode(&msg, &packet2);
  837. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  838. memset(&packet2, 0, sizeof(packet2));
  839. mavlink_msg_to_send_buffer(buffer, &msg);
  840. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  841. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  842. }
  843. mavlink_msg_scaled_imu_decode(last_msg, &packet2);
  844. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  845. memset(&packet2, 0, sizeof(packet2));
  846. mavlink_msg_scaled_imu_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag , packet1.temperature );
  847. mavlink_msg_scaled_imu_decode(last_msg, &packet2);
  848. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  849. }
  850. static void mavlink_test_raw_imu(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  851. {
  852. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  853. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  854. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_RAW_IMU >= 256) {
  855. return;
  856. }
  857. #endif
  858. mavlink_message_t msg;
  859. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  860. uint16_t i;
  861. mavlink_raw_imu_t packet_in = {
  862. 93372036854775807ULL,17651,17755,17859,17963,18067,18171,18275,18379,18483,211,18639
  863. };
  864. mavlink_raw_imu_t packet1, packet2;
  865. memset(&packet1, 0, sizeof(packet1));
  866. packet1.time_usec = packet_in.time_usec;
  867. packet1.xacc = packet_in.xacc;
  868. packet1.yacc = packet_in.yacc;
  869. packet1.zacc = packet_in.zacc;
  870. packet1.xgyro = packet_in.xgyro;
  871. packet1.ygyro = packet_in.ygyro;
  872. packet1.zgyro = packet_in.zgyro;
  873. packet1.xmag = packet_in.xmag;
  874. packet1.ymag = packet_in.ymag;
  875. packet1.zmag = packet_in.zmag;
  876. packet1.id = packet_in.id;
  877. packet1.temperature = packet_in.temperature;
  878. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  879. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  880. // cope with extensions
  881. memset(MAVLINK_MSG_ID_RAW_IMU_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_RAW_IMU_MIN_LEN);
  882. }
  883. #endif
  884. memset(&packet2, 0, sizeof(packet2));
  885. mavlink_msg_raw_imu_encode(system_id, component_id, &msg, &packet1);
  886. mavlink_msg_raw_imu_decode(&msg, &packet2);
  887. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  888. memset(&packet2, 0, sizeof(packet2));
  889. mavlink_msg_raw_imu_pack(system_id, component_id, &msg , packet1.time_usec , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag , packet1.id , packet1.temperature );
  890. mavlink_msg_raw_imu_decode(&msg, &packet2);
  891. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  892. memset(&packet2, 0, sizeof(packet2));
  893. mavlink_msg_raw_imu_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag , packet1.id , packet1.temperature );
  894. mavlink_msg_raw_imu_decode(&msg, &packet2);
  895. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  896. memset(&packet2, 0, sizeof(packet2));
  897. mavlink_msg_to_send_buffer(buffer, &msg);
  898. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  899. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  900. }
  901. mavlink_msg_raw_imu_decode(last_msg, &packet2);
  902. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  903. memset(&packet2, 0, sizeof(packet2));
  904. mavlink_msg_raw_imu_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag , packet1.id , packet1.temperature );
  905. mavlink_msg_raw_imu_decode(last_msg, &packet2);
  906. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  907. }
  908. static void mavlink_test_raw_pressure(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  909. {
  910. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  911. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  912. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_RAW_PRESSURE >= 256) {
  913. return;
  914. }
  915. #endif
  916. mavlink_message_t msg;
  917. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  918. uint16_t i;
  919. mavlink_raw_pressure_t packet_in = {
  920. 93372036854775807ULL,17651,17755,17859,17963
  921. };
  922. mavlink_raw_pressure_t packet1, packet2;
  923. memset(&packet1, 0, sizeof(packet1));
  924. packet1.time_usec = packet_in.time_usec;
  925. packet1.press_abs = packet_in.press_abs;
  926. packet1.press_diff1 = packet_in.press_diff1;
  927. packet1.press_diff2 = packet_in.press_diff2;
  928. packet1.temperature = packet_in.temperature;
  929. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  930. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  931. // cope with extensions
  932. memset(MAVLINK_MSG_ID_RAW_PRESSURE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_RAW_PRESSURE_MIN_LEN);
  933. }
  934. #endif
  935. memset(&packet2, 0, sizeof(packet2));
  936. mavlink_msg_raw_pressure_encode(system_id, component_id, &msg, &packet1);
  937. mavlink_msg_raw_pressure_decode(&msg, &packet2);
  938. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  939. memset(&packet2, 0, sizeof(packet2));
  940. mavlink_msg_raw_pressure_pack(system_id, component_id, &msg , packet1.time_usec , packet1.press_abs , packet1.press_diff1 , packet1.press_diff2 , packet1.temperature );
  941. mavlink_msg_raw_pressure_decode(&msg, &packet2);
  942. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  943. memset(&packet2, 0, sizeof(packet2));
  944. mavlink_msg_raw_pressure_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.press_abs , packet1.press_diff1 , packet1.press_diff2 , packet1.temperature );
  945. mavlink_msg_raw_pressure_decode(&msg, &packet2);
  946. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  947. memset(&packet2, 0, sizeof(packet2));
  948. mavlink_msg_to_send_buffer(buffer, &msg);
  949. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  950. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  951. }
  952. mavlink_msg_raw_pressure_decode(last_msg, &packet2);
  953. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  954. memset(&packet2, 0, sizeof(packet2));
  955. mavlink_msg_raw_pressure_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.press_abs , packet1.press_diff1 , packet1.press_diff2 , packet1.temperature );
  956. mavlink_msg_raw_pressure_decode(last_msg, &packet2);
  957. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  958. }
  959. static void mavlink_test_scaled_pressure(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  960. {
  961. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  962. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  963. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SCALED_PRESSURE >= 256) {
  964. return;
  965. }
  966. #endif
  967. mavlink_message_t msg;
  968. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  969. uint16_t i;
  970. mavlink_scaled_pressure_t packet_in = {
  971. 963497464,45.0,73.0,17859
  972. };
  973. mavlink_scaled_pressure_t packet1, packet2;
  974. memset(&packet1, 0, sizeof(packet1));
  975. packet1.time_boot_ms = packet_in.time_boot_ms;
  976. packet1.press_abs = packet_in.press_abs;
  977. packet1.press_diff = packet_in.press_diff;
  978. packet1.temperature = packet_in.temperature;
  979. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  980. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  981. // cope with extensions
  982. memset(MAVLINK_MSG_ID_SCALED_PRESSURE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SCALED_PRESSURE_MIN_LEN);
  983. }
  984. #endif
  985. memset(&packet2, 0, sizeof(packet2));
  986. mavlink_msg_scaled_pressure_encode(system_id, component_id, &msg, &packet1);
  987. mavlink_msg_scaled_pressure_decode(&msg, &packet2);
  988. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  989. memset(&packet2, 0, sizeof(packet2));
  990. mavlink_msg_scaled_pressure_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.press_abs , packet1.press_diff , packet1.temperature );
  991. mavlink_msg_scaled_pressure_decode(&msg, &packet2);
  992. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  993. memset(&packet2, 0, sizeof(packet2));
  994. mavlink_msg_scaled_pressure_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.press_abs , packet1.press_diff , packet1.temperature );
  995. mavlink_msg_scaled_pressure_decode(&msg, &packet2);
  996. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  997. memset(&packet2, 0, sizeof(packet2));
  998. mavlink_msg_to_send_buffer(buffer, &msg);
  999. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  1000. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  1001. }
  1002. mavlink_msg_scaled_pressure_decode(last_msg, &packet2);
  1003. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1004. memset(&packet2, 0, sizeof(packet2));
  1005. mavlink_msg_scaled_pressure_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.press_abs , packet1.press_diff , packet1.temperature );
  1006. mavlink_msg_scaled_pressure_decode(last_msg, &packet2);
  1007. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1008. }
  1009. static void mavlink_test_attitude(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  1010. {
  1011. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  1012. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  1013. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ATTITUDE >= 256) {
  1014. return;
  1015. }
  1016. #endif
  1017. mavlink_message_t msg;
  1018. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  1019. uint16_t i;
  1020. mavlink_attitude_t packet_in = {
  1021. 963497464,45.0,73.0,101.0,129.0,157.0,185.0
  1022. };
  1023. mavlink_attitude_t packet1, packet2;
  1024. memset(&packet1, 0, sizeof(packet1));
  1025. packet1.time_boot_ms = packet_in.time_boot_ms;
  1026. packet1.roll = packet_in.roll;
  1027. packet1.pitch = packet_in.pitch;
  1028. packet1.yaw = packet_in.yaw;
  1029. packet1.rollspeed = packet_in.rollspeed;
  1030. packet1.pitchspeed = packet_in.pitchspeed;
  1031. packet1.yawspeed = packet_in.yawspeed;
  1032. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  1033. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  1034. // cope with extensions
  1035. memset(MAVLINK_MSG_ID_ATTITUDE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ATTITUDE_MIN_LEN);
  1036. }
  1037. #endif
  1038. memset(&packet2, 0, sizeof(packet2));
  1039. mavlink_msg_attitude_encode(system_id, component_id, &msg, &packet1);
  1040. mavlink_msg_attitude_decode(&msg, &packet2);
  1041. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1042. memset(&packet2, 0, sizeof(packet2));
  1043. mavlink_msg_attitude_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.roll , packet1.pitch , packet1.yaw , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed );
  1044. mavlink_msg_attitude_decode(&msg, &packet2);
  1045. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1046. memset(&packet2, 0, sizeof(packet2));
  1047. mavlink_msg_attitude_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.roll , packet1.pitch , packet1.yaw , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed );
  1048. mavlink_msg_attitude_decode(&msg, &packet2);
  1049. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1050. memset(&packet2, 0, sizeof(packet2));
  1051. mavlink_msg_to_send_buffer(buffer, &msg);
  1052. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  1053. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  1054. }
  1055. mavlink_msg_attitude_decode(last_msg, &packet2);
  1056. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1057. memset(&packet2, 0, sizeof(packet2));
  1058. mavlink_msg_attitude_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.roll , packet1.pitch , packet1.yaw , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed );
  1059. mavlink_msg_attitude_decode(last_msg, &packet2);
  1060. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1061. }
  1062. static void mavlink_test_attitude_quaternion(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  1063. {
  1064. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  1065. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  1066. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ATTITUDE_QUATERNION >= 256) {
  1067. return;
  1068. }
  1069. #endif
  1070. mavlink_message_t msg;
  1071. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  1072. uint16_t i;
  1073. mavlink_attitude_quaternion_t packet_in = {
  1074. 963497464,45.0,73.0,101.0,129.0,157.0,185.0,213.0,{ 241.0, 242.0, 243.0, 244.0 }
  1075. };
  1076. mavlink_attitude_quaternion_t packet1, packet2;
  1077. memset(&packet1, 0, sizeof(packet1));
  1078. packet1.time_boot_ms = packet_in.time_boot_ms;
  1079. packet1.q1 = packet_in.q1;
  1080. packet1.q2 = packet_in.q2;
  1081. packet1.q3 = packet_in.q3;
  1082. packet1.q4 = packet_in.q4;
  1083. packet1.rollspeed = packet_in.rollspeed;
  1084. packet1.pitchspeed = packet_in.pitchspeed;
  1085. packet1.yawspeed = packet_in.yawspeed;
  1086. mav_array_memcpy(packet1.repr_offset_q, packet_in.repr_offset_q, sizeof(float)*4);
  1087. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  1088. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  1089. // cope with extensions
  1090. memset(MAVLINK_MSG_ID_ATTITUDE_QUATERNION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ATTITUDE_QUATERNION_MIN_LEN);
  1091. }
  1092. #endif
  1093. memset(&packet2, 0, sizeof(packet2));
  1094. mavlink_msg_attitude_quaternion_encode(system_id, component_id, &msg, &packet1);
  1095. mavlink_msg_attitude_quaternion_decode(&msg, &packet2);
  1096. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1097. memset(&packet2, 0, sizeof(packet2));
  1098. mavlink_msg_attitude_quaternion_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.q1 , packet1.q2 , packet1.q3 , packet1.q4 , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed , packet1.repr_offset_q );
  1099. mavlink_msg_attitude_quaternion_decode(&msg, &packet2);
  1100. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1101. memset(&packet2, 0, sizeof(packet2));
  1102. mavlink_msg_attitude_quaternion_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.q1 , packet1.q2 , packet1.q3 , packet1.q4 , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed , packet1.repr_offset_q );
  1103. mavlink_msg_attitude_quaternion_decode(&msg, &packet2);
  1104. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1105. memset(&packet2, 0, sizeof(packet2));
  1106. mavlink_msg_to_send_buffer(buffer, &msg);
  1107. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  1108. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  1109. }
  1110. mavlink_msg_attitude_quaternion_decode(last_msg, &packet2);
  1111. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1112. memset(&packet2, 0, sizeof(packet2));
  1113. mavlink_msg_attitude_quaternion_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.q1 , packet1.q2 , packet1.q3 , packet1.q4 , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed , packet1.repr_offset_q );
  1114. mavlink_msg_attitude_quaternion_decode(last_msg, &packet2);
  1115. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1116. }
  1117. static void mavlink_test_local_position_ned(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  1118. {
  1119. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  1120. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  1121. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_LOCAL_POSITION_NED >= 256) {
  1122. return;
  1123. }
  1124. #endif
  1125. mavlink_message_t msg;
  1126. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  1127. uint16_t i;
  1128. mavlink_local_position_ned_t packet_in = {
  1129. 963497464,45.0,73.0,101.0,129.0,157.0,185.0
  1130. };
  1131. mavlink_local_position_ned_t packet1, packet2;
  1132. memset(&packet1, 0, sizeof(packet1));
  1133. packet1.time_boot_ms = packet_in.time_boot_ms;
  1134. packet1.x = packet_in.x;
  1135. packet1.y = packet_in.y;
  1136. packet1.z = packet_in.z;
  1137. packet1.vx = packet_in.vx;
  1138. packet1.vy = packet_in.vy;
  1139. packet1.vz = packet_in.vz;
  1140. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  1141. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  1142. // cope with extensions
  1143. memset(MAVLINK_MSG_ID_LOCAL_POSITION_NED_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_LOCAL_POSITION_NED_MIN_LEN);
  1144. }
  1145. #endif
  1146. memset(&packet2, 0, sizeof(packet2));
  1147. mavlink_msg_local_position_ned_encode(system_id, component_id, &msg, &packet1);
  1148. mavlink_msg_local_position_ned_decode(&msg, &packet2);
  1149. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1150. memset(&packet2, 0, sizeof(packet2));
  1151. mavlink_msg_local_position_ned_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.x , packet1.y , packet1.z , packet1.vx , packet1.vy , packet1.vz );
  1152. mavlink_msg_local_position_ned_decode(&msg, &packet2);
  1153. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1154. memset(&packet2, 0, sizeof(packet2));
  1155. mavlink_msg_local_position_ned_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.x , packet1.y , packet1.z , packet1.vx , packet1.vy , packet1.vz );
  1156. mavlink_msg_local_position_ned_decode(&msg, &packet2);
  1157. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1158. memset(&packet2, 0, sizeof(packet2));
  1159. mavlink_msg_to_send_buffer(buffer, &msg);
  1160. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  1161. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  1162. }
  1163. mavlink_msg_local_position_ned_decode(last_msg, &packet2);
  1164. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1165. memset(&packet2, 0, sizeof(packet2));
  1166. mavlink_msg_local_position_ned_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.x , packet1.y , packet1.z , packet1.vx , packet1.vy , packet1.vz );
  1167. mavlink_msg_local_position_ned_decode(last_msg, &packet2);
  1168. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1169. }
  1170. static void mavlink_test_global_position_int(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  1171. {
  1172. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  1173. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  1174. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GLOBAL_POSITION_INT >= 256) {
  1175. return;
  1176. }
  1177. #endif
  1178. mavlink_message_t msg;
  1179. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  1180. uint16_t i;
  1181. mavlink_global_position_int_t packet_in = {
  1182. 963497464,963497672,963497880,963498088,963498296,18275,18379,18483,18587
  1183. };
  1184. mavlink_global_position_int_t packet1, packet2;
  1185. memset(&packet1, 0, sizeof(packet1));
  1186. packet1.time_boot_ms = packet_in.time_boot_ms;
  1187. packet1.lat = packet_in.lat;
  1188. packet1.lon = packet_in.lon;
  1189. packet1.alt = packet_in.alt;
  1190. packet1.relative_alt = packet_in.relative_alt;
  1191. packet1.vx = packet_in.vx;
  1192. packet1.vy = packet_in.vy;
  1193. packet1.vz = packet_in.vz;
  1194. packet1.hdg = packet_in.hdg;
  1195. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  1196. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  1197. // cope with extensions
  1198. memset(MAVLINK_MSG_ID_GLOBAL_POSITION_INT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GLOBAL_POSITION_INT_MIN_LEN);
  1199. }
  1200. #endif
  1201. memset(&packet2, 0, sizeof(packet2));
  1202. mavlink_msg_global_position_int_encode(system_id, component_id, &msg, &packet1);
  1203. mavlink_msg_global_position_int_decode(&msg, &packet2);
  1204. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1205. memset(&packet2, 0, sizeof(packet2));
  1206. mavlink_msg_global_position_int_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.lat , packet1.lon , packet1.alt , packet1.relative_alt , packet1.vx , packet1.vy , packet1.vz , packet1.hdg );
  1207. mavlink_msg_global_position_int_decode(&msg, &packet2);
  1208. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1209. memset(&packet2, 0, sizeof(packet2));
  1210. mavlink_msg_global_position_int_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.lat , packet1.lon , packet1.alt , packet1.relative_alt , packet1.vx , packet1.vy , packet1.vz , packet1.hdg );
  1211. mavlink_msg_global_position_int_decode(&msg, &packet2);
  1212. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1213. memset(&packet2, 0, sizeof(packet2));
  1214. mavlink_msg_to_send_buffer(buffer, &msg);
  1215. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  1216. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  1217. }
  1218. mavlink_msg_global_position_int_decode(last_msg, &packet2);
  1219. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1220. memset(&packet2, 0, sizeof(packet2));
  1221. mavlink_msg_global_position_int_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.lat , packet1.lon , packet1.alt , packet1.relative_alt , packet1.vx , packet1.vy , packet1.vz , packet1.hdg );
  1222. mavlink_msg_global_position_int_decode(last_msg, &packet2);
  1223. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1224. }
  1225. static void mavlink_test_rc_channels_scaled(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  1226. {
  1227. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  1228. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  1229. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_RC_CHANNELS_SCALED >= 256) {
  1230. return;
  1231. }
  1232. #endif
  1233. mavlink_message_t msg;
  1234. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  1235. uint16_t i;
  1236. mavlink_rc_channels_scaled_t packet_in = {
  1237. 963497464,17443,17547,17651,17755,17859,17963,18067,18171,65,132
  1238. };
  1239. mavlink_rc_channels_scaled_t packet1, packet2;
  1240. memset(&packet1, 0, sizeof(packet1));
  1241. packet1.time_boot_ms = packet_in.time_boot_ms;
  1242. packet1.chan1_scaled = packet_in.chan1_scaled;
  1243. packet1.chan2_scaled = packet_in.chan2_scaled;
  1244. packet1.chan3_scaled = packet_in.chan3_scaled;
  1245. packet1.chan4_scaled = packet_in.chan4_scaled;
  1246. packet1.chan5_scaled = packet_in.chan5_scaled;
  1247. packet1.chan6_scaled = packet_in.chan6_scaled;
  1248. packet1.chan7_scaled = packet_in.chan7_scaled;
  1249. packet1.chan8_scaled = packet_in.chan8_scaled;
  1250. packet1.port = packet_in.port;
  1251. packet1.rssi = packet_in.rssi;
  1252. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  1253. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  1254. // cope with extensions
  1255. memset(MAVLINK_MSG_ID_RC_CHANNELS_SCALED_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_RC_CHANNELS_SCALED_MIN_LEN);
  1256. }
  1257. #endif
  1258. memset(&packet2, 0, sizeof(packet2));
  1259. mavlink_msg_rc_channels_scaled_encode(system_id, component_id, &msg, &packet1);
  1260. mavlink_msg_rc_channels_scaled_decode(&msg, &packet2);
  1261. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1262. memset(&packet2, 0, sizeof(packet2));
  1263. mavlink_msg_rc_channels_scaled_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.port , packet1.chan1_scaled , packet1.chan2_scaled , packet1.chan3_scaled , packet1.chan4_scaled , packet1.chan5_scaled , packet1.chan6_scaled , packet1.chan7_scaled , packet1.chan8_scaled , packet1.rssi );
  1264. mavlink_msg_rc_channels_scaled_decode(&msg, &packet2);
  1265. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1266. memset(&packet2, 0, sizeof(packet2));
  1267. mavlink_msg_rc_channels_scaled_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.port , packet1.chan1_scaled , packet1.chan2_scaled , packet1.chan3_scaled , packet1.chan4_scaled , packet1.chan5_scaled , packet1.chan6_scaled , packet1.chan7_scaled , packet1.chan8_scaled , packet1.rssi );
  1268. mavlink_msg_rc_channels_scaled_decode(&msg, &packet2);
  1269. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1270. memset(&packet2, 0, sizeof(packet2));
  1271. mavlink_msg_to_send_buffer(buffer, &msg);
  1272. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  1273. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  1274. }
  1275. mavlink_msg_rc_channels_scaled_decode(last_msg, &packet2);
  1276. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1277. memset(&packet2, 0, sizeof(packet2));
  1278. mavlink_msg_rc_channels_scaled_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.port , packet1.chan1_scaled , packet1.chan2_scaled , packet1.chan3_scaled , packet1.chan4_scaled , packet1.chan5_scaled , packet1.chan6_scaled , packet1.chan7_scaled , packet1.chan8_scaled , packet1.rssi );
  1279. mavlink_msg_rc_channels_scaled_decode(last_msg, &packet2);
  1280. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1281. }
  1282. static void mavlink_test_rc_channels_raw(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  1283. {
  1284. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  1285. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  1286. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_RC_CHANNELS_RAW >= 256) {
  1287. return;
  1288. }
  1289. #endif
  1290. mavlink_message_t msg;
  1291. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  1292. uint16_t i;
  1293. mavlink_rc_channels_raw_t packet_in = {
  1294. 963497464,17443,17547,17651,17755,17859,17963,18067,18171,65,132
  1295. };
  1296. mavlink_rc_channels_raw_t packet1, packet2;
  1297. memset(&packet1, 0, sizeof(packet1));
  1298. packet1.time_boot_ms = packet_in.time_boot_ms;
  1299. packet1.chan1_raw = packet_in.chan1_raw;
  1300. packet1.chan2_raw = packet_in.chan2_raw;
  1301. packet1.chan3_raw = packet_in.chan3_raw;
  1302. packet1.chan4_raw = packet_in.chan4_raw;
  1303. packet1.chan5_raw = packet_in.chan5_raw;
  1304. packet1.chan6_raw = packet_in.chan6_raw;
  1305. packet1.chan7_raw = packet_in.chan7_raw;
  1306. packet1.chan8_raw = packet_in.chan8_raw;
  1307. packet1.port = packet_in.port;
  1308. packet1.rssi = packet_in.rssi;
  1309. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  1310. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  1311. // cope with extensions
  1312. memset(MAVLINK_MSG_ID_RC_CHANNELS_RAW_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_RC_CHANNELS_RAW_MIN_LEN);
  1313. }
  1314. #endif
  1315. memset(&packet2, 0, sizeof(packet2));
  1316. mavlink_msg_rc_channels_raw_encode(system_id, component_id, &msg, &packet1);
  1317. mavlink_msg_rc_channels_raw_decode(&msg, &packet2);
  1318. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1319. memset(&packet2, 0, sizeof(packet2));
  1320. mavlink_msg_rc_channels_raw_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.port , packet1.chan1_raw , packet1.chan2_raw , packet1.chan3_raw , packet1.chan4_raw , packet1.chan5_raw , packet1.chan6_raw , packet1.chan7_raw , packet1.chan8_raw , packet1.rssi );
  1321. mavlink_msg_rc_channels_raw_decode(&msg, &packet2);
  1322. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1323. memset(&packet2, 0, sizeof(packet2));
  1324. mavlink_msg_rc_channels_raw_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.port , packet1.chan1_raw , packet1.chan2_raw , packet1.chan3_raw , packet1.chan4_raw , packet1.chan5_raw , packet1.chan6_raw , packet1.chan7_raw , packet1.chan8_raw , packet1.rssi );
  1325. mavlink_msg_rc_channels_raw_decode(&msg, &packet2);
  1326. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1327. memset(&packet2, 0, sizeof(packet2));
  1328. mavlink_msg_to_send_buffer(buffer, &msg);
  1329. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  1330. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  1331. }
  1332. mavlink_msg_rc_channels_raw_decode(last_msg, &packet2);
  1333. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1334. memset(&packet2, 0, sizeof(packet2));
  1335. mavlink_msg_rc_channels_raw_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.port , packet1.chan1_raw , packet1.chan2_raw , packet1.chan3_raw , packet1.chan4_raw , packet1.chan5_raw , packet1.chan6_raw , packet1.chan7_raw , packet1.chan8_raw , packet1.rssi );
  1336. mavlink_msg_rc_channels_raw_decode(last_msg, &packet2);
  1337. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1338. }
  1339. static void mavlink_test_servo_output_raw(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  1340. {
  1341. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  1342. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  1343. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SERVO_OUTPUT_RAW >= 256) {
  1344. return;
  1345. }
  1346. #endif
  1347. mavlink_message_t msg;
  1348. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  1349. uint16_t i;
  1350. mavlink_servo_output_raw_t packet_in = {
  1351. 963497464,17443,17547,17651,17755,17859,17963,18067,18171,65,18327,18431,18535,18639,18743,18847,18951,19055
  1352. };
  1353. mavlink_servo_output_raw_t packet1, packet2;
  1354. memset(&packet1, 0, sizeof(packet1));
  1355. packet1.time_usec = packet_in.time_usec;
  1356. packet1.servo1_raw = packet_in.servo1_raw;
  1357. packet1.servo2_raw = packet_in.servo2_raw;
  1358. packet1.servo3_raw = packet_in.servo3_raw;
  1359. packet1.servo4_raw = packet_in.servo4_raw;
  1360. packet1.servo5_raw = packet_in.servo5_raw;
  1361. packet1.servo6_raw = packet_in.servo6_raw;
  1362. packet1.servo7_raw = packet_in.servo7_raw;
  1363. packet1.servo8_raw = packet_in.servo8_raw;
  1364. packet1.port = packet_in.port;
  1365. packet1.servo9_raw = packet_in.servo9_raw;
  1366. packet1.servo10_raw = packet_in.servo10_raw;
  1367. packet1.servo11_raw = packet_in.servo11_raw;
  1368. packet1.servo12_raw = packet_in.servo12_raw;
  1369. packet1.servo13_raw = packet_in.servo13_raw;
  1370. packet1.servo14_raw = packet_in.servo14_raw;
  1371. packet1.servo15_raw = packet_in.servo15_raw;
  1372. packet1.servo16_raw = packet_in.servo16_raw;
  1373. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  1374. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  1375. // cope with extensions
  1376. memset(MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_MIN_LEN);
  1377. }
  1378. #endif
  1379. memset(&packet2, 0, sizeof(packet2));
  1380. mavlink_msg_servo_output_raw_encode(system_id, component_id, &msg, &packet1);
  1381. mavlink_msg_servo_output_raw_decode(&msg, &packet2);
  1382. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1383. memset(&packet2, 0, sizeof(packet2));
  1384. mavlink_msg_servo_output_raw_pack(system_id, component_id, &msg , packet1.time_usec , packet1.port , packet1.servo1_raw , packet1.servo2_raw , packet1.servo3_raw , packet1.servo4_raw , packet1.servo5_raw , packet1.servo6_raw , packet1.servo7_raw , packet1.servo8_raw , packet1.servo9_raw , packet1.servo10_raw , packet1.servo11_raw , packet1.servo12_raw , packet1.servo13_raw , packet1.servo14_raw , packet1.servo15_raw , packet1.servo16_raw );
  1385. mavlink_msg_servo_output_raw_decode(&msg, &packet2);
  1386. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1387. memset(&packet2, 0, sizeof(packet2));
  1388. mavlink_msg_servo_output_raw_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.port , packet1.servo1_raw , packet1.servo2_raw , packet1.servo3_raw , packet1.servo4_raw , packet1.servo5_raw , packet1.servo6_raw , packet1.servo7_raw , packet1.servo8_raw , packet1.servo9_raw , packet1.servo10_raw , packet1.servo11_raw , packet1.servo12_raw , packet1.servo13_raw , packet1.servo14_raw , packet1.servo15_raw , packet1.servo16_raw );
  1389. mavlink_msg_servo_output_raw_decode(&msg, &packet2);
  1390. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1391. memset(&packet2, 0, sizeof(packet2));
  1392. mavlink_msg_to_send_buffer(buffer, &msg);
  1393. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  1394. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  1395. }
  1396. mavlink_msg_servo_output_raw_decode(last_msg, &packet2);
  1397. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1398. memset(&packet2, 0, sizeof(packet2));
  1399. mavlink_msg_servo_output_raw_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.port , packet1.servo1_raw , packet1.servo2_raw , packet1.servo3_raw , packet1.servo4_raw , packet1.servo5_raw , packet1.servo6_raw , packet1.servo7_raw , packet1.servo8_raw , packet1.servo9_raw , packet1.servo10_raw , packet1.servo11_raw , packet1.servo12_raw , packet1.servo13_raw , packet1.servo14_raw , packet1.servo15_raw , packet1.servo16_raw );
  1400. mavlink_msg_servo_output_raw_decode(last_msg, &packet2);
  1401. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1402. }
  1403. static void mavlink_test_mission_request_partial_list(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  1404. {
  1405. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  1406. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  1407. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MISSION_REQUEST_PARTIAL_LIST >= 256) {
  1408. return;
  1409. }
  1410. #endif
  1411. mavlink_message_t msg;
  1412. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  1413. uint16_t i;
  1414. mavlink_mission_request_partial_list_t packet_in = {
  1415. 17235,17339,17,84,151
  1416. };
  1417. mavlink_mission_request_partial_list_t packet1, packet2;
  1418. memset(&packet1, 0, sizeof(packet1));
  1419. packet1.start_index = packet_in.start_index;
  1420. packet1.end_index = packet_in.end_index;
  1421. packet1.target_system = packet_in.target_system;
  1422. packet1.target_component = packet_in.target_component;
  1423. packet1.mission_type = packet_in.mission_type;
  1424. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  1425. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  1426. // cope with extensions
  1427. memset(MAVLINK_MSG_ID_MISSION_REQUEST_PARTIAL_LIST_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MISSION_REQUEST_PARTIAL_LIST_MIN_LEN);
  1428. }
  1429. #endif
  1430. memset(&packet2, 0, sizeof(packet2));
  1431. mavlink_msg_mission_request_partial_list_encode(system_id, component_id, &msg, &packet1);
  1432. mavlink_msg_mission_request_partial_list_decode(&msg, &packet2);
  1433. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1434. memset(&packet2, 0, sizeof(packet2));
  1435. mavlink_msg_mission_request_partial_list_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.start_index , packet1.end_index , packet1.mission_type );
  1436. mavlink_msg_mission_request_partial_list_decode(&msg, &packet2);
  1437. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1438. memset(&packet2, 0, sizeof(packet2));
  1439. mavlink_msg_mission_request_partial_list_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.start_index , packet1.end_index , packet1.mission_type );
  1440. mavlink_msg_mission_request_partial_list_decode(&msg, &packet2);
  1441. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1442. memset(&packet2, 0, sizeof(packet2));
  1443. mavlink_msg_to_send_buffer(buffer, &msg);
  1444. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  1445. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  1446. }
  1447. mavlink_msg_mission_request_partial_list_decode(last_msg, &packet2);
  1448. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1449. memset(&packet2, 0, sizeof(packet2));
  1450. mavlink_msg_mission_request_partial_list_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.start_index , packet1.end_index , packet1.mission_type );
  1451. mavlink_msg_mission_request_partial_list_decode(last_msg, &packet2);
  1452. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1453. }
  1454. static void mavlink_test_mission_write_partial_list(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  1455. {
  1456. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  1457. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  1458. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MISSION_WRITE_PARTIAL_LIST >= 256) {
  1459. return;
  1460. }
  1461. #endif
  1462. mavlink_message_t msg;
  1463. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  1464. uint16_t i;
  1465. mavlink_mission_write_partial_list_t packet_in = {
  1466. 17235,17339,17,84,151
  1467. };
  1468. mavlink_mission_write_partial_list_t packet1, packet2;
  1469. memset(&packet1, 0, sizeof(packet1));
  1470. packet1.start_index = packet_in.start_index;
  1471. packet1.end_index = packet_in.end_index;
  1472. packet1.target_system = packet_in.target_system;
  1473. packet1.target_component = packet_in.target_component;
  1474. packet1.mission_type = packet_in.mission_type;
  1475. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  1476. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  1477. // cope with extensions
  1478. memset(MAVLINK_MSG_ID_MISSION_WRITE_PARTIAL_LIST_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MISSION_WRITE_PARTIAL_LIST_MIN_LEN);
  1479. }
  1480. #endif
  1481. memset(&packet2, 0, sizeof(packet2));
  1482. mavlink_msg_mission_write_partial_list_encode(system_id, component_id, &msg, &packet1);
  1483. mavlink_msg_mission_write_partial_list_decode(&msg, &packet2);
  1484. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1485. memset(&packet2, 0, sizeof(packet2));
  1486. mavlink_msg_mission_write_partial_list_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.start_index , packet1.end_index , packet1.mission_type );
  1487. mavlink_msg_mission_write_partial_list_decode(&msg, &packet2);
  1488. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1489. memset(&packet2, 0, sizeof(packet2));
  1490. mavlink_msg_mission_write_partial_list_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.start_index , packet1.end_index , packet1.mission_type );
  1491. mavlink_msg_mission_write_partial_list_decode(&msg, &packet2);
  1492. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1493. memset(&packet2, 0, sizeof(packet2));
  1494. mavlink_msg_to_send_buffer(buffer, &msg);
  1495. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  1496. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  1497. }
  1498. mavlink_msg_mission_write_partial_list_decode(last_msg, &packet2);
  1499. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1500. memset(&packet2, 0, sizeof(packet2));
  1501. mavlink_msg_mission_write_partial_list_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.start_index , packet1.end_index , packet1.mission_type );
  1502. mavlink_msg_mission_write_partial_list_decode(last_msg, &packet2);
  1503. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1504. }
  1505. static void mavlink_test_mission_item(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  1506. {
  1507. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  1508. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  1509. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MISSION_ITEM >= 256) {
  1510. return;
  1511. }
  1512. #endif
  1513. mavlink_message_t msg;
  1514. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  1515. uint16_t i;
  1516. mavlink_mission_item_t packet_in = {
  1517. 17.0,45.0,73.0,101.0,129.0,157.0,185.0,18691,18795,101,168,235,46,113,180
  1518. };
  1519. mavlink_mission_item_t packet1, packet2;
  1520. memset(&packet1, 0, sizeof(packet1));
  1521. packet1.param1 = packet_in.param1;
  1522. packet1.param2 = packet_in.param2;
  1523. packet1.param3 = packet_in.param3;
  1524. packet1.param4 = packet_in.param4;
  1525. packet1.x = packet_in.x;
  1526. packet1.y = packet_in.y;
  1527. packet1.z = packet_in.z;
  1528. packet1.seq = packet_in.seq;
  1529. packet1.command = packet_in.command;
  1530. packet1.target_system = packet_in.target_system;
  1531. packet1.target_component = packet_in.target_component;
  1532. packet1.frame = packet_in.frame;
  1533. packet1.current = packet_in.current;
  1534. packet1.autocontinue = packet_in.autocontinue;
  1535. packet1.mission_type = packet_in.mission_type;
  1536. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  1537. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  1538. // cope with extensions
  1539. memset(MAVLINK_MSG_ID_MISSION_ITEM_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MISSION_ITEM_MIN_LEN);
  1540. }
  1541. #endif
  1542. memset(&packet2, 0, sizeof(packet2));
  1543. mavlink_msg_mission_item_encode(system_id, component_id, &msg, &packet1);
  1544. mavlink_msg_mission_item_decode(&msg, &packet2);
  1545. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1546. memset(&packet2, 0, sizeof(packet2));
  1547. mavlink_msg_mission_item_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.seq , packet1.frame , packet1.command , packet1.current , packet1.autocontinue , packet1.param1 , packet1.param2 , packet1.param3 , packet1.param4 , packet1.x , packet1.y , packet1.z , packet1.mission_type );
  1548. mavlink_msg_mission_item_decode(&msg, &packet2);
  1549. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1550. memset(&packet2, 0, sizeof(packet2));
  1551. mavlink_msg_mission_item_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.seq , packet1.frame , packet1.command , packet1.current , packet1.autocontinue , packet1.param1 , packet1.param2 , packet1.param3 , packet1.param4 , packet1.x , packet1.y , packet1.z , packet1.mission_type );
  1552. mavlink_msg_mission_item_decode(&msg, &packet2);
  1553. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1554. memset(&packet2, 0, sizeof(packet2));
  1555. mavlink_msg_to_send_buffer(buffer, &msg);
  1556. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  1557. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  1558. }
  1559. mavlink_msg_mission_item_decode(last_msg, &packet2);
  1560. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1561. memset(&packet2, 0, sizeof(packet2));
  1562. mavlink_msg_mission_item_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.seq , packet1.frame , packet1.command , packet1.current , packet1.autocontinue , packet1.param1 , packet1.param2 , packet1.param3 , packet1.param4 , packet1.x , packet1.y , packet1.z , packet1.mission_type );
  1563. mavlink_msg_mission_item_decode(last_msg, &packet2);
  1564. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1565. }
  1566. static void mavlink_test_mission_request(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  1567. {
  1568. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  1569. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  1570. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MISSION_REQUEST >= 256) {
  1571. return;
  1572. }
  1573. #endif
  1574. mavlink_message_t msg;
  1575. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  1576. uint16_t i;
  1577. mavlink_mission_request_t packet_in = {
  1578. 17235,139,206,17
  1579. };
  1580. mavlink_mission_request_t packet1, packet2;
  1581. memset(&packet1, 0, sizeof(packet1));
  1582. packet1.seq = packet_in.seq;
  1583. packet1.target_system = packet_in.target_system;
  1584. packet1.target_component = packet_in.target_component;
  1585. packet1.mission_type = packet_in.mission_type;
  1586. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  1587. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  1588. // cope with extensions
  1589. memset(MAVLINK_MSG_ID_MISSION_REQUEST_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MISSION_REQUEST_MIN_LEN);
  1590. }
  1591. #endif
  1592. memset(&packet2, 0, sizeof(packet2));
  1593. mavlink_msg_mission_request_encode(system_id, component_id, &msg, &packet1);
  1594. mavlink_msg_mission_request_decode(&msg, &packet2);
  1595. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1596. memset(&packet2, 0, sizeof(packet2));
  1597. mavlink_msg_mission_request_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.seq , packet1.mission_type );
  1598. mavlink_msg_mission_request_decode(&msg, &packet2);
  1599. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1600. memset(&packet2, 0, sizeof(packet2));
  1601. mavlink_msg_mission_request_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.seq , packet1.mission_type );
  1602. mavlink_msg_mission_request_decode(&msg, &packet2);
  1603. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1604. memset(&packet2, 0, sizeof(packet2));
  1605. mavlink_msg_to_send_buffer(buffer, &msg);
  1606. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  1607. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  1608. }
  1609. mavlink_msg_mission_request_decode(last_msg, &packet2);
  1610. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1611. memset(&packet2, 0, sizeof(packet2));
  1612. mavlink_msg_mission_request_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.seq , packet1.mission_type );
  1613. mavlink_msg_mission_request_decode(last_msg, &packet2);
  1614. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1615. }
  1616. static void mavlink_test_mission_set_current(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  1617. {
  1618. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  1619. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  1620. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MISSION_SET_CURRENT >= 256) {
  1621. return;
  1622. }
  1623. #endif
  1624. mavlink_message_t msg;
  1625. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  1626. uint16_t i;
  1627. mavlink_mission_set_current_t packet_in = {
  1628. 17235,139,206
  1629. };
  1630. mavlink_mission_set_current_t packet1, packet2;
  1631. memset(&packet1, 0, sizeof(packet1));
  1632. packet1.seq = packet_in.seq;
  1633. packet1.target_system = packet_in.target_system;
  1634. packet1.target_component = packet_in.target_component;
  1635. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  1636. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  1637. // cope with extensions
  1638. memset(MAVLINK_MSG_ID_MISSION_SET_CURRENT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MISSION_SET_CURRENT_MIN_LEN);
  1639. }
  1640. #endif
  1641. memset(&packet2, 0, sizeof(packet2));
  1642. mavlink_msg_mission_set_current_encode(system_id, component_id, &msg, &packet1);
  1643. mavlink_msg_mission_set_current_decode(&msg, &packet2);
  1644. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1645. memset(&packet2, 0, sizeof(packet2));
  1646. mavlink_msg_mission_set_current_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.seq );
  1647. mavlink_msg_mission_set_current_decode(&msg, &packet2);
  1648. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1649. memset(&packet2, 0, sizeof(packet2));
  1650. mavlink_msg_mission_set_current_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.seq );
  1651. mavlink_msg_mission_set_current_decode(&msg, &packet2);
  1652. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1653. memset(&packet2, 0, sizeof(packet2));
  1654. mavlink_msg_to_send_buffer(buffer, &msg);
  1655. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  1656. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  1657. }
  1658. mavlink_msg_mission_set_current_decode(last_msg, &packet2);
  1659. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1660. memset(&packet2, 0, sizeof(packet2));
  1661. mavlink_msg_mission_set_current_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.seq );
  1662. mavlink_msg_mission_set_current_decode(last_msg, &packet2);
  1663. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1664. }
  1665. static void mavlink_test_mission_current(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  1666. {
  1667. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  1668. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  1669. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MISSION_CURRENT >= 256) {
  1670. return;
  1671. }
  1672. #endif
  1673. mavlink_message_t msg;
  1674. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  1675. uint16_t i;
  1676. mavlink_mission_current_t packet_in = {
  1677. 17235
  1678. };
  1679. mavlink_mission_current_t packet1, packet2;
  1680. memset(&packet1, 0, sizeof(packet1));
  1681. packet1.seq = packet_in.seq;
  1682. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  1683. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  1684. // cope with extensions
  1685. memset(MAVLINK_MSG_ID_MISSION_CURRENT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MISSION_CURRENT_MIN_LEN);
  1686. }
  1687. #endif
  1688. memset(&packet2, 0, sizeof(packet2));
  1689. mavlink_msg_mission_current_encode(system_id, component_id, &msg, &packet1);
  1690. mavlink_msg_mission_current_decode(&msg, &packet2);
  1691. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1692. memset(&packet2, 0, sizeof(packet2));
  1693. mavlink_msg_mission_current_pack(system_id, component_id, &msg , packet1.seq );
  1694. mavlink_msg_mission_current_decode(&msg, &packet2);
  1695. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1696. memset(&packet2, 0, sizeof(packet2));
  1697. mavlink_msg_mission_current_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.seq );
  1698. mavlink_msg_mission_current_decode(&msg, &packet2);
  1699. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1700. memset(&packet2, 0, sizeof(packet2));
  1701. mavlink_msg_to_send_buffer(buffer, &msg);
  1702. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  1703. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  1704. }
  1705. mavlink_msg_mission_current_decode(last_msg, &packet2);
  1706. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1707. memset(&packet2, 0, sizeof(packet2));
  1708. mavlink_msg_mission_current_send(MAVLINK_COMM_1 , packet1.seq );
  1709. mavlink_msg_mission_current_decode(last_msg, &packet2);
  1710. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1711. }
  1712. static void mavlink_test_mission_request_list(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  1713. {
  1714. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  1715. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  1716. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MISSION_REQUEST_LIST >= 256) {
  1717. return;
  1718. }
  1719. #endif
  1720. mavlink_message_t msg;
  1721. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  1722. uint16_t i;
  1723. mavlink_mission_request_list_t packet_in = {
  1724. 5,72,139
  1725. };
  1726. mavlink_mission_request_list_t packet1, packet2;
  1727. memset(&packet1, 0, sizeof(packet1));
  1728. packet1.target_system = packet_in.target_system;
  1729. packet1.target_component = packet_in.target_component;
  1730. packet1.mission_type = packet_in.mission_type;
  1731. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  1732. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  1733. // cope with extensions
  1734. memset(MAVLINK_MSG_ID_MISSION_REQUEST_LIST_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MISSION_REQUEST_LIST_MIN_LEN);
  1735. }
  1736. #endif
  1737. memset(&packet2, 0, sizeof(packet2));
  1738. mavlink_msg_mission_request_list_encode(system_id, component_id, &msg, &packet1);
  1739. mavlink_msg_mission_request_list_decode(&msg, &packet2);
  1740. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1741. memset(&packet2, 0, sizeof(packet2));
  1742. mavlink_msg_mission_request_list_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.mission_type );
  1743. mavlink_msg_mission_request_list_decode(&msg, &packet2);
  1744. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1745. memset(&packet2, 0, sizeof(packet2));
  1746. mavlink_msg_mission_request_list_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.mission_type );
  1747. mavlink_msg_mission_request_list_decode(&msg, &packet2);
  1748. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1749. memset(&packet2, 0, sizeof(packet2));
  1750. mavlink_msg_to_send_buffer(buffer, &msg);
  1751. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  1752. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  1753. }
  1754. mavlink_msg_mission_request_list_decode(last_msg, &packet2);
  1755. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1756. memset(&packet2, 0, sizeof(packet2));
  1757. mavlink_msg_mission_request_list_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.mission_type );
  1758. mavlink_msg_mission_request_list_decode(last_msg, &packet2);
  1759. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1760. }
  1761. static void mavlink_test_mission_count(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  1762. {
  1763. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  1764. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  1765. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MISSION_COUNT >= 256) {
  1766. return;
  1767. }
  1768. #endif
  1769. mavlink_message_t msg;
  1770. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  1771. uint16_t i;
  1772. mavlink_mission_count_t packet_in = {
  1773. 17235,139,206,17
  1774. };
  1775. mavlink_mission_count_t packet1, packet2;
  1776. memset(&packet1, 0, sizeof(packet1));
  1777. packet1.count = packet_in.count;
  1778. packet1.target_system = packet_in.target_system;
  1779. packet1.target_component = packet_in.target_component;
  1780. packet1.mission_type = packet_in.mission_type;
  1781. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  1782. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  1783. // cope with extensions
  1784. memset(MAVLINK_MSG_ID_MISSION_COUNT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MISSION_COUNT_MIN_LEN);
  1785. }
  1786. #endif
  1787. memset(&packet2, 0, sizeof(packet2));
  1788. mavlink_msg_mission_count_encode(system_id, component_id, &msg, &packet1);
  1789. mavlink_msg_mission_count_decode(&msg, &packet2);
  1790. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1791. memset(&packet2, 0, sizeof(packet2));
  1792. mavlink_msg_mission_count_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.count , packet1.mission_type );
  1793. mavlink_msg_mission_count_decode(&msg, &packet2);
  1794. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1795. memset(&packet2, 0, sizeof(packet2));
  1796. mavlink_msg_mission_count_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.count , packet1.mission_type );
  1797. mavlink_msg_mission_count_decode(&msg, &packet2);
  1798. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1799. memset(&packet2, 0, sizeof(packet2));
  1800. mavlink_msg_to_send_buffer(buffer, &msg);
  1801. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  1802. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  1803. }
  1804. mavlink_msg_mission_count_decode(last_msg, &packet2);
  1805. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1806. memset(&packet2, 0, sizeof(packet2));
  1807. mavlink_msg_mission_count_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.count , packet1.mission_type );
  1808. mavlink_msg_mission_count_decode(last_msg, &packet2);
  1809. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1810. }
  1811. static void mavlink_test_mission_clear_all(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  1812. {
  1813. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  1814. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  1815. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MISSION_CLEAR_ALL >= 256) {
  1816. return;
  1817. }
  1818. #endif
  1819. mavlink_message_t msg;
  1820. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  1821. uint16_t i;
  1822. mavlink_mission_clear_all_t packet_in = {
  1823. 5,72,139
  1824. };
  1825. mavlink_mission_clear_all_t packet1, packet2;
  1826. memset(&packet1, 0, sizeof(packet1));
  1827. packet1.target_system = packet_in.target_system;
  1828. packet1.target_component = packet_in.target_component;
  1829. packet1.mission_type = packet_in.mission_type;
  1830. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  1831. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  1832. // cope with extensions
  1833. memset(MAVLINK_MSG_ID_MISSION_CLEAR_ALL_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MISSION_CLEAR_ALL_MIN_LEN);
  1834. }
  1835. #endif
  1836. memset(&packet2, 0, sizeof(packet2));
  1837. mavlink_msg_mission_clear_all_encode(system_id, component_id, &msg, &packet1);
  1838. mavlink_msg_mission_clear_all_decode(&msg, &packet2);
  1839. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1840. memset(&packet2, 0, sizeof(packet2));
  1841. mavlink_msg_mission_clear_all_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.mission_type );
  1842. mavlink_msg_mission_clear_all_decode(&msg, &packet2);
  1843. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1844. memset(&packet2, 0, sizeof(packet2));
  1845. mavlink_msg_mission_clear_all_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.mission_type );
  1846. mavlink_msg_mission_clear_all_decode(&msg, &packet2);
  1847. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1848. memset(&packet2, 0, sizeof(packet2));
  1849. mavlink_msg_to_send_buffer(buffer, &msg);
  1850. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  1851. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  1852. }
  1853. mavlink_msg_mission_clear_all_decode(last_msg, &packet2);
  1854. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1855. memset(&packet2, 0, sizeof(packet2));
  1856. mavlink_msg_mission_clear_all_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.mission_type );
  1857. mavlink_msg_mission_clear_all_decode(last_msg, &packet2);
  1858. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1859. }
  1860. static void mavlink_test_mission_item_reached(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  1861. {
  1862. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  1863. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  1864. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MISSION_ITEM_REACHED >= 256) {
  1865. return;
  1866. }
  1867. #endif
  1868. mavlink_message_t msg;
  1869. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  1870. uint16_t i;
  1871. mavlink_mission_item_reached_t packet_in = {
  1872. 17235
  1873. };
  1874. mavlink_mission_item_reached_t packet1, packet2;
  1875. memset(&packet1, 0, sizeof(packet1));
  1876. packet1.seq = packet_in.seq;
  1877. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  1878. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  1879. // cope with extensions
  1880. memset(MAVLINK_MSG_ID_MISSION_ITEM_REACHED_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MISSION_ITEM_REACHED_MIN_LEN);
  1881. }
  1882. #endif
  1883. memset(&packet2, 0, sizeof(packet2));
  1884. mavlink_msg_mission_item_reached_encode(system_id, component_id, &msg, &packet1);
  1885. mavlink_msg_mission_item_reached_decode(&msg, &packet2);
  1886. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1887. memset(&packet2, 0, sizeof(packet2));
  1888. mavlink_msg_mission_item_reached_pack(system_id, component_id, &msg , packet1.seq );
  1889. mavlink_msg_mission_item_reached_decode(&msg, &packet2);
  1890. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1891. memset(&packet2, 0, sizeof(packet2));
  1892. mavlink_msg_mission_item_reached_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.seq );
  1893. mavlink_msg_mission_item_reached_decode(&msg, &packet2);
  1894. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1895. memset(&packet2, 0, sizeof(packet2));
  1896. mavlink_msg_to_send_buffer(buffer, &msg);
  1897. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  1898. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  1899. }
  1900. mavlink_msg_mission_item_reached_decode(last_msg, &packet2);
  1901. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1902. memset(&packet2, 0, sizeof(packet2));
  1903. mavlink_msg_mission_item_reached_send(MAVLINK_COMM_1 , packet1.seq );
  1904. mavlink_msg_mission_item_reached_decode(last_msg, &packet2);
  1905. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1906. }
  1907. static void mavlink_test_mission_ack(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  1908. {
  1909. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  1910. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  1911. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MISSION_ACK >= 256) {
  1912. return;
  1913. }
  1914. #endif
  1915. mavlink_message_t msg;
  1916. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  1917. uint16_t i;
  1918. mavlink_mission_ack_t packet_in = {
  1919. 5,72,139,206
  1920. };
  1921. mavlink_mission_ack_t packet1, packet2;
  1922. memset(&packet1, 0, sizeof(packet1));
  1923. packet1.target_system = packet_in.target_system;
  1924. packet1.target_component = packet_in.target_component;
  1925. packet1.type = packet_in.type;
  1926. packet1.mission_type = packet_in.mission_type;
  1927. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  1928. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  1929. // cope with extensions
  1930. memset(MAVLINK_MSG_ID_MISSION_ACK_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MISSION_ACK_MIN_LEN);
  1931. }
  1932. #endif
  1933. memset(&packet2, 0, sizeof(packet2));
  1934. mavlink_msg_mission_ack_encode(system_id, component_id, &msg, &packet1);
  1935. mavlink_msg_mission_ack_decode(&msg, &packet2);
  1936. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1937. memset(&packet2, 0, sizeof(packet2));
  1938. mavlink_msg_mission_ack_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.type , packet1.mission_type );
  1939. mavlink_msg_mission_ack_decode(&msg, &packet2);
  1940. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1941. memset(&packet2, 0, sizeof(packet2));
  1942. mavlink_msg_mission_ack_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.type , packet1.mission_type );
  1943. mavlink_msg_mission_ack_decode(&msg, &packet2);
  1944. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1945. memset(&packet2, 0, sizeof(packet2));
  1946. mavlink_msg_to_send_buffer(buffer, &msg);
  1947. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  1948. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  1949. }
  1950. mavlink_msg_mission_ack_decode(last_msg, &packet2);
  1951. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1952. memset(&packet2, 0, sizeof(packet2));
  1953. mavlink_msg_mission_ack_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.type , packet1.mission_type );
  1954. mavlink_msg_mission_ack_decode(last_msg, &packet2);
  1955. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1956. }
  1957. static void mavlink_test_set_gps_global_origin(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  1958. {
  1959. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  1960. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  1961. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN >= 256) {
  1962. return;
  1963. }
  1964. #endif
  1965. mavlink_message_t msg;
  1966. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  1967. uint16_t i;
  1968. mavlink_set_gps_global_origin_t packet_in = {
  1969. 963497464,963497672,963497880,41,93372036854776626ULL
  1970. };
  1971. mavlink_set_gps_global_origin_t packet1, packet2;
  1972. memset(&packet1, 0, sizeof(packet1));
  1973. packet1.latitude = packet_in.latitude;
  1974. packet1.longitude = packet_in.longitude;
  1975. packet1.altitude = packet_in.altitude;
  1976. packet1.target_system = packet_in.target_system;
  1977. packet1.time_usec = packet_in.time_usec;
  1978. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  1979. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  1980. // cope with extensions
  1981. memset(MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_MIN_LEN);
  1982. }
  1983. #endif
  1984. memset(&packet2, 0, sizeof(packet2));
  1985. mavlink_msg_set_gps_global_origin_encode(system_id, component_id, &msg, &packet1);
  1986. mavlink_msg_set_gps_global_origin_decode(&msg, &packet2);
  1987. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1988. memset(&packet2, 0, sizeof(packet2));
  1989. mavlink_msg_set_gps_global_origin_pack(system_id, component_id, &msg , packet1.target_system , packet1.latitude , packet1.longitude , packet1.altitude , packet1.time_usec );
  1990. mavlink_msg_set_gps_global_origin_decode(&msg, &packet2);
  1991. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1992. memset(&packet2, 0, sizeof(packet2));
  1993. mavlink_msg_set_gps_global_origin_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.latitude , packet1.longitude , packet1.altitude , packet1.time_usec );
  1994. mavlink_msg_set_gps_global_origin_decode(&msg, &packet2);
  1995. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  1996. memset(&packet2, 0, sizeof(packet2));
  1997. mavlink_msg_to_send_buffer(buffer, &msg);
  1998. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  1999. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  2000. }
  2001. mavlink_msg_set_gps_global_origin_decode(last_msg, &packet2);
  2002. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2003. memset(&packet2, 0, sizeof(packet2));
  2004. mavlink_msg_set_gps_global_origin_send(MAVLINK_COMM_1 , packet1.target_system , packet1.latitude , packet1.longitude , packet1.altitude , packet1.time_usec );
  2005. mavlink_msg_set_gps_global_origin_decode(last_msg, &packet2);
  2006. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2007. }
  2008. static void mavlink_test_gps_global_origin(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  2009. {
  2010. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  2011. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  2012. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN >= 256) {
  2013. return;
  2014. }
  2015. #endif
  2016. mavlink_message_t msg;
  2017. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  2018. uint16_t i;
  2019. mavlink_gps_global_origin_t packet_in = {
  2020. 963497464,963497672,963497880,93372036854776563ULL
  2021. };
  2022. mavlink_gps_global_origin_t packet1, packet2;
  2023. memset(&packet1, 0, sizeof(packet1));
  2024. packet1.latitude = packet_in.latitude;
  2025. packet1.longitude = packet_in.longitude;
  2026. packet1.altitude = packet_in.altitude;
  2027. packet1.time_usec = packet_in.time_usec;
  2028. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  2029. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  2030. // cope with extensions
  2031. memset(MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_MIN_LEN);
  2032. }
  2033. #endif
  2034. memset(&packet2, 0, sizeof(packet2));
  2035. mavlink_msg_gps_global_origin_encode(system_id, component_id, &msg, &packet1);
  2036. mavlink_msg_gps_global_origin_decode(&msg, &packet2);
  2037. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2038. memset(&packet2, 0, sizeof(packet2));
  2039. mavlink_msg_gps_global_origin_pack(system_id, component_id, &msg , packet1.latitude , packet1.longitude , packet1.altitude , packet1.time_usec );
  2040. mavlink_msg_gps_global_origin_decode(&msg, &packet2);
  2041. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2042. memset(&packet2, 0, sizeof(packet2));
  2043. mavlink_msg_gps_global_origin_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.latitude , packet1.longitude , packet1.altitude , packet1.time_usec );
  2044. mavlink_msg_gps_global_origin_decode(&msg, &packet2);
  2045. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2046. memset(&packet2, 0, sizeof(packet2));
  2047. mavlink_msg_to_send_buffer(buffer, &msg);
  2048. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  2049. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  2050. }
  2051. mavlink_msg_gps_global_origin_decode(last_msg, &packet2);
  2052. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2053. memset(&packet2, 0, sizeof(packet2));
  2054. mavlink_msg_gps_global_origin_send(MAVLINK_COMM_1 , packet1.latitude , packet1.longitude , packet1.altitude , packet1.time_usec );
  2055. mavlink_msg_gps_global_origin_decode(last_msg, &packet2);
  2056. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2057. }
  2058. static void mavlink_test_param_map_rc(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  2059. {
  2060. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  2061. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  2062. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_PARAM_MAP_RC >= 256) {
  2063. return;
  2064. }
  2065. #endif
  2066. mavlink_message_t msg;
  2067. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  2068. uint16_t i;
  2069. mavlink_param_map_rc_t packet_in = {
  2070. 17.0,45.0,73.0,101.0,18067,187,254,"UVWXYZABCDEFGHI",113
  2071. };
  2072. mavlink_param_map_rc_t packet1, packet2;
  2073. memset(&packet1, 0, sizeof(packet1));
  2074. packet1.param_value0 = packet_in.param_value0;
  2075. packet1.scale = packet_in.scale;
  2076. packet1.param_value_min = packet_in.param_value_min;
  2077. packet1.param_value_max = packet_in.param_value_max;
  2078. packet1.param_index = packet_in.param_index;
  2079. packet1.target_system = packet_in.target_system;
  2080. packet1.target_component = packet_in.target_component;
  2081. packet1.parameter_rc_channel_index = packet_in.parameter_rc_channel_index;
  2082. mav_array_memcpy(packet1.param_id, packet_in.param_id, sizeof(char)*16);
  2083. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  2084. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  2085. // cope with extensions
  2086. memset(MAVLINK_MSG_ID_PARAM_MAP_RC_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_PARAM_MAP_RC_MIN_LEN);
  2087. }
  2088. #endif
  2089. memset(&packet2, 0, sizeof(packet2));
  2090. mavlink_msg_param_map_rc_encode(system_id, component_id, &msg, &packet1);
  2091. mavlink_msg_param_map_rc_decode(&msg, &packet2);
  2092. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2093. memset(&packet2, 0, sizeof(packet2));
  2094. mavlink_msg_param_map_rc_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.param_id , packet1.param_index , packet1.parameter_rc_channel_index , packet1.param_value0 , packet1.scale , packet1.param_value_min , packet1.param_value_max );
  2095. mavlink_msg_param_map_rc_decode(&msg, &packet2);
  2096. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2097. memset(&packet2, 0, sizeof(packet2));
  2098. mavlink_msg_param_map_rc_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.param_id , packet1.param_index , packet1.parameter_rc_channel_index , packet1.param_value0 , packet1.scale , packet1.param_value_min , packet1.param_value_max );
  2099. mavlink_msg_param_map_rc_decode(&msg, &packet2);
  2100. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2101. memset(&packet2, 0, sizeof(packet2));
  2102. mavlink_msg_to_send_buffer(buffer, &msg);
  2103. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  2104. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  2105. }
  2106. mavlink_msg_param_map_rc_decode(last_msg, &packet2);
  2107. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2108. memset(&packet2, 0, sizeof(packet2));
  2109. mavlink_msg_param_map_rc_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.param_id , packet1.param_index , packet1.parameter_rc_channel_index , packet1.param_value0 , packet1.scale , packet1.param_value_min , packet1.param_value_max );
  2110. mavlink_msg_param_map_rc_decode(last_msg, &packet2);
  2111. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2112. }
  2113. static void mavlink_test_mission_request_int(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  2114. {
  2115. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  2116. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  2117. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MISSION_REQUEST_INT >= 256) {
  2118. return;
  2119. }
  2120. #endif
  2121. mavlink_message_t msg;
  2122. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  2123. uint16_t i;
  2124. mavlink_mission_request_int_t packet_in = {
  2125. 17235,139,206,17
  2126. };
  2127. mavlink_mission_request_int_t packet1, packet2;
  2128. memset(&packet1, 0, sizeof(packet1));
  2129. packet1.seq = packet_in.seq;
  2130. packet1.target_system = packet_in.target_system;
  2131. packet1.target_component = packet_in.target_component;
  2132. packet1.mission_type = packet_in.mission_type;
  2133. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  2134. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  2135. // cope with extensions
  2136. memset(MAVLINK_MSG_ID_MISSION_REQUEST_INT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MISSION_REQUEST_INT_MIN_LEN);
  2137. }
  2138. #endif
  2139. memset(&packet2, 0, sizeof(packet2));
  2140. mavlink_msg_mission_request_int_encode(system_id, component_id, &msg, &packet1);
  2141. mavlink_msg_mission_request_int_decode(&msg, &packet2);
  2142. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2143. memset(&packet2, 0, sizeof(packet2));
  2144. mavlink_msg_mission_request_int_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.seq , packet1.mission_type );
  2145. mavlink_msg_mission_request_int_decode(&msg, &packet2);
  2146. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2147. memset(&packet2, 0, sizeof(packet2));
  2148. mavlink_msg_mission_request_int_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.seq , packet1.mission_type );
  2149. mavlink_msg_mission_request_int_decode(&msg, &packet2);
  2150. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2151. memset(&packet2, 0, sizeof(packet2));
  2152. mavlink_msg_to_send_buffer(buffer, &msg);
  2153. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  2154. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  2155. }
  2156. mavlink_msg_mission_request_int_decode(last_msg, &packet2);
  2157. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2158. memset(&packet2, 0, sizeof(packet2));
  2159. mavlink_msg_mission_request_int_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.seq , packet1.mission_type );
  2160. mavlink_msg_mission_request_int_decode(last_msg, &packet2);
  2161. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2162. }
  2163. static void mavlink_test_mission_changed(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  2164. {
  2165. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  2166. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  2167. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MISSION_CHANGED >= 256) {
  2168. return;
  2169. }
  2170. #endif
  2171. mavlink_message_t msg;
  2172. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  2173. uint16_t i;
  2174. mavlink_mission_changed_t packet_in = {
  2175. 17235,17339,17,84,151
  2176. };
  2177. mavlink_mission_changed_t packet1, packet2;
  2178. memset(&packet1, 0, sizeof(packet1));
  2179. packet1.start_index = packet_in.start_index;
  2180. packet1.end_index = packet_in.end_index;
  2181. packet1.origin_sysid = packet_in.origin_sysid;
  2182. packet1.origin_compid = packet_in.origin_compid;
  2183. packet1.mission_type = packet_in.mission_type;
  2184. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  2185. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  2186. // cope with extensions
  2187. memset(MAVLINK_MSG_ID_MISSION_CHANGED_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MISSION_CHANGED_MIN_LEN);
  2188. }
  2189. #endif
  2190. memset(&packet2, 0, sizeof(packet2));
  2191. mavlink_msg_mission_changed_encode(system_id, component_id, &msg, &packet1);
  2192. mavlink_msg_mission_changed_decode(&msg, &packet2);
  2193. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2194. memset(&packet2, 0, sizeof(packet2));
  2195. mavlink_msg_mission_changed_pack(system_id, component_id, &msg , packet1.start_index , packet1.end_index , packet1.origin_sysid , packet1.origin_compid , packet1.mission_type );
  2196. mavlink_msg_mission_changed_decode(&msg, &packet2);
  2197. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2198. memset(&packet2, 0, sizeof(packet2));
  2199. mavlink_msg_mission_changed_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.start_index , packet1.end_index , packet1.origin_sysid , packet1.origin_compid , packet1.mission_type );
  2200. mavlink_msg_mission_changed_decode(&msg, &packet2);
  2201. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2202. memset(&packet2, 0, sizeof(packet2));
  2203. mavlink_msg_to_send_buffer(buffer, &msg);
  2204. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  2205. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  2206. }
  2207. mavlink_msg_mission_changed_decode(last_msg, &packet2);
  2208. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2209. memset(&packet2, 0, sizeof(packet2));
  2210. mavlink_msg_mission_changed_send(MAVLINK_COMM_1 , packet1.start_index , packet1.end_index , packet1.origin_sysid , packet1.origin_compid , packet1.mission_type );
  2211. mavlink_msg_mission_changed_decode(last_msg, &packet2);
  2212. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2213. }
  2214. static void mavlink_test_safety_set_allowed_area(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  2215. {
  2216. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  2217. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  2218. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA >= 256) {
  2219. return;
  2220. }
  2221. #endif
  2222. mavlink_message_t msg;
  2223. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  2224. uint16_t i;
  2225. mavlink_safety_set_allowed_area_t packet_in = {
  2226. 17.0,45.0,73.0,101.0,129.0,157.0,77,144,211
  2227. };
  2228. mavlink_safety_set_allowed_area_t packet1, packet2;
  2229. memset(&packet1, 0, sizeof(packet1));
  2230. packet1.p1x = packet_in.p1x;
  2231. packet1.p1y = packet_in.p1y;
  2232. packet1.p1z = packet_in.p1z;
  2233. packet1.p2x = packet_in.p2x;
  2234. packet1.p2y = packet_in.p2y;
  2235. packet1.p2z = packet_in.p2z;
  2236. packet1.target_system = packet_in.target_system;
  2237. packet1.target_component = packet_in.target_component;
  2238. packet1.frame = packet_in.frame;
  2239. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  2240. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  2241. // cope with extensions
  2242. memset(MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_MIN_LEN);
  2243. }
  2244. #endif
  2245. memset(&packet2, 0, sizeof(packet2));
  2246. mavlink_msg_safety_set_allowed_area_encode(system_id, component_id, &msg, &packet1);
  2247. mavlink_msg_safety_set_allowed_area_decode(&msg, &packet2);
  2248. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2249. memset(&packet2, 0, sizeof(packet2));
  2250. mavlink_msg_safety_set_allowed_area_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.frame , packet1.p1x , packet1.p1y , packet1.p1z , packet1.p2x , packet1.p2y , packet1.p2z );
  2251. mavlink_msg_safety_set_allowed_area_decode(&msg, &packet2);
  2252. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2253. memset(&packet2, 0, sizeof(packet2));
  2254. mavlink_msg_safety_set_allowed_area_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.frame , packet1.p1x , packet1.p1y , packet1.p1z , packet1.p2x , packet1.p2y , packet1.p2z );
  2255. mavlink_msg_safety_set_allowed_area_decode(&msg, &packet2);
  2256. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2257. memset(&packet2, 0, sizeof(packet2));
  2258. mavlink_msg_to_send_buffer(buffer, &msg);
  2259. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  2260. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  2261. }
  2262. mavlink_msg_safety_set_allowed_area_decode(last_msg, &packet2);
  2263. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2264. memset(&packet2, 0, sizeof(packet2));
  2265. mavlink_msg_safety_set_allowed_area_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.frame , packet1.p1x , packet1.p1y , packet1.p1z , packet1.p2x , packet1.p2y , packet1.p2z );
  2266. mavlink_msg_safety_set_allowed_area_decode(last_msg, &packet2);
  2267. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2268. }
  2269. static void mavlink_test_safety_allowed_area(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  2270. {
  2271. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  2272. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  2273. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA >= 256) {
  2274. return;
  2275. }
  2276. #endif
  2277. mavlink_message_t msg;
  2278. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  2279. uint16_t i;
  2280. mavlink_safety_allowed_area_t packet_in = {
  2281. 17.0,45.0,73.0,101.0,129.0,157.0,77
  2282. };
  2283. mavlink_safety_allowed_area_t packet1, packet2;
  2284. memset(&packet1, 0, sizeof(packet1));
  2285. packet1.p1x = packet_in.p1x;
  2286. packet1.p1y = packet_in.p1y;
  2287. packet1.p1z = packet_in.p1z;
  2288. packet1.p2x = packet_in.p2x;
  2289. packet1.p2y = packet_in.p2y;
  2290. packet1.p2z = packet_in.p2z;
  2291. packet1.frame = packet_in.frame;
  2292. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  2293. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  2294. // cope with extensions
  2295. memset(MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_MIN_LEN);
  2296. }
  2297. #endif
  2298. memset(&packet2, 0, sizeof(packet2));
  2299. mavlink_msg_safety_allowed_area_encode(system_id, component_id, &msg, &packet1);
  2300. mavlink_msg_safety_allowed_area_decode(&msg, &packet2);
  2301. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2302. memset(&packet2, 0, sizeof(packet2));
  2303. mavlink_msg_safety_allowed_area_pack(system_id, component_id, &msg , packet1.frame , packet1.p1x , packet1.p1y , packet1.p1z , packet1.p2x , packet1.p2y , packet1.p2z );
  2304. mavlink_msg_safety_allowed_area_decode(&msg, &packet2);
  2305. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2306. memset(&packet2, 0, sizeof(packet2));
  2307. mavlink_msg_safety_allowed_area_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.frame , packet1.p1x , packet1.p1y , packet1.p1z , packet1.p2x , packet1.p2y , packet1.p2z );
  2308. mavlink_msg_safety_allowed_area_decode(&msg, &packet2);
  2309. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2310. memset(&packet2, 0, sizeof(packet2));
  2311. mavlink_msg_to_send_buffer(buffer, &msg);
  2312. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  2313. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  2314. }
  2315. mavlink_msg_safety_allowed_area_decode(last_msg, &packet2);
  2316. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2317. memset(&packet2, 0, sizeof(packet2));
  2318. mavlink_msg_safety_allowed_area_send(MAVLINK_COMM_1 , packet1.frame , packet1.p1x , packet1.p1y , packet1.p1z , packet1.p2x , packet1.p2y , packet1.p2z );
  2319. mavlink_msg_safety_allowed_area_decode(last_msg, &packet2);
  2320. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2321. }
  2322. static void mavlink_test_attitude_quaternion_cov(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  2323. {
  2324. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  2325. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  2326. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV >= 256) {
  2327. return;
  2328. }
  2329. #endif
  2330. mavlink_message_t msg;
  2331. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  2332. uint16_t i;
  2333. mavlink_attitude_quaternion_cov_t packet_in = {
  2334. 93372036854775807ULL,{ 73.0, 74.0, 75.0, 76.0 },185.0,213.0,241.0,{ 269.0, 270.0, 271.0, 272.0, 273.0, 274.0, 275.0, 276.0, 277.0 }
  2335. };
  2336. mavlink_attitude_quaternion_cov_t packet1, packet2;
  2337. memset(&packet1, 0, sizeof(packet1));
  2338. packet1.time_usec = packet_in.time_usec;
  2339. packet1.rollspeed = packet_in.rollspeed;
  2340. packet1.pitchspeed = packet_in.pitchspeed;
  2341. packet1.yawspeed = packet_in.yawspeed;
  2342. mav_array_memcpy(packet1.q, packet_in.q, sizeof(float)*4);
  2343. mav_array_memcpy(packet1.covariance, packet_in.covariance, sizeof(float)*9);
  2344. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  2345. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  2346. // cope with extensions
  2347. memset(MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_MIN_LEN);
  2348. }
  2349. #endif
  2350. memset(&packet2, 0, sizeof(packet2));
  2351. mavlink_msg_attitude_quaternion_cov_encode(system_id, component_id, &msg, &packet1);
  2352. mavlink_msg_attitude_quaternion_cov_decode(&msg, &packet2);
  2353. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2354. memset(&packet2, 0, sizeof(packet2));
  2355. mavlink_msg_attitude_quaternion_cov_pack(system_id, component_id, &msg , packet1.time_usec , packet1.q , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed , packet1.covariance );
  2356. mavlink_msg_attitude_quaternion_cov_decode(&msg, &packet2);
  2357. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2358. memset(&packet2, 0, sizeof(packet2));
  2359. mavlink_msg_attitude_quaternion_cov_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.q , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed , packet1.covariance );
  2360. mavlink_msg_attitude_quaternion_cov_decode(&msg, &packet2);
  2361. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2362. memset(&packet2, 0, sizeof(packet2));
  2363. mavlink_msg_to_send_buffer(buffer, &msg);
  2364. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  2365. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  2366. }
  2367. mavlink_msg_attitude_quaternion_cov_decode(last_msg, &packet2);
  2368. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2369. memset(&packet2, 0, sizeof(packet2));
  2370. mavlink_msg_attitude_quaternion_cov_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.q , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed , packet1.covariance );
  2371. mavlink_msg_attitude_quaternion_cov_decode(last_msg, &packet2);
  2372. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2373. }
  2374. static void mavlink_test_nav_controller_output(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  2375. {
  2376. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  2377. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  2378. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT >= 256) {
  2379. return;
  2380. }
  2381. #endif
  2382. mavlink_message_t msg;
  2383. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  2384. uint16_t i;
  2385. mavlink_nav_controller_output_t packet_in = {
  2386. 17.0,45.0,73.0,101.0,129.0,18275,18379,18483
  2387. };
  2388. mavlink_nav_controller_output_t packet1, packet2;
  2389. memset(&packet1, 0, sizeof(packet1));
  2390. packet1.nav_roll = packet_in.nav_roll;
  2391. packet1.nav_pitch = packet_in.nav_pitch;
  2392. packet1.alt_error = packet_in.alt_error;
  2393. packet1.aspd_error = packet_in.aspd_error;
  2394. packet1.xtrack_error = packet_in.xtrack_error;
  2395. packet1.nav_bearing = packet_in.nav_bearing;
  2396. packet1.target_bearing = packet_in.target_bearing;
  2397. packet1.wp_dist = packet_in.wp_dist;
  2398. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  2399. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  2400. // cope with extensions
  2401. memset(MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_MIN_LEN);
  2402. }
  2403. #endif
  2404. memset(&packet2, 0, sizeof(packet2));
  2405. mavlink_msg_nav_controller_output_encode(system_id, component_id, &msg, &packet1);
  2406. mavlink_msg_nav_controller_output_decode(&msg, &packet2);
  2407. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2408. memset(&packet2, 0, sizeof(packet2));
  2409. mavlink_msg_nav_controller_output_pack(system_id, component_id, &msg , packet1.nav_roll , packet1.nav_pitch , packet1.nav_bearing , packet1.target_bearing , packet1.wp_dist , packet1.alt_error , packet1.aspd_error , packet1.xtrack_error );
  2410. mavlink_msg_nav_controller_output_decode(&msg, &packet2);
  2411. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2412. memset(&packet2, 0, sizeof(packet2));
  2413. mavlink_msg_nav_controller_output_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.nav_roll , packet1.nav_pitch , packet1.nav_bearing , packet1.target_bearing , packet1.wp_dist , packet1.alt_error , packet1.aspd_error , packet1.xtrack_error );
  2414. mavlink_msg_nav_controller_output_decode(&msg, &packet2);
  2415. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2416. memset(&packet2, 0, sizeof(packet2));
  2417. mavlink_msg_to_send_buffer(buffer, &msg);
  2418. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  2419. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  2420. }
  2421. mavlink_msg_nav_controller_output_decode(last_msg, &packet2);
  2422. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2423. memset(&packet2, 0, sizeof(packet2));
  2424. mavlink_msg_nav_controller_output_send(MAVLINK_COMM_1 , packet1.nav_roll , packet1.nav_pitch , packet1.nav_bearing , packet1.target_bearing , packet1.wp_dist , packet1.alt_error , packet1.aspd_error , packet1.xtrack_error );
  2425. mavlink_msg_nav_controller_output_decode(last_msg, &packet2);
  2426. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2427. }
  2428. static void mavlink_test_global_position_int_cov(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  2429. {
  2430. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  2431. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  2432. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV >= 256) {
  2433. return;
  2434. }
  2435. #endif
  2436. mavlink_message_t msg;
  2437. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  2438. uint16_t i;
  2439. mavlink_global_position_int_cov_t packet_in = {
  2440. 93372036854775807ULL,963497880,963498088,963498296,963498504,185.0,213.0,241.0,{ 269.0, 270.0, 271.0, 272.0, 273.0, 274.0, 275.0, 276.0, 277.0, 278.0, 279.0, 280.0, 281.0, 282.0, 283.0, 284.0, 285.0, 286.0, 287.0, 288.0, 289.0, 290.0, 291.0, 292.0, 293.0, 294.0, 295.0, 296.0, 297.0, 298.0, 299.0, 300.0, 301.0, 302.0, 303.0, 304.0 },33
  2441. };
  2442. mavlink_global_position_int_cov_t packet1, packet2;
  2443. memset(&packet1, 0, sizeof(packet1));
  2444. packet1.time_usec = packet_in.time_usec;
  2445. packet1.lat = packet_in.lat;
  2446. packet1.lon = packet_in.lon;
  2447. packet1.alt = packet_in.alt;
  2448. packet1.relative_alt = packet_in.relative_alt;
  2449. packet1.vx = packet_in.vx;
  2450. packet1.vy = packet_in.vy;
  2451. packet1.vz = packet_in.vz;
  2452. packet1.estimator_type = packet_in.estimator_type;
  2453. mav_array_memcpy(packet1.covariance, packet_in.covariance, sizeof(float)*36);
  2454. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  2455. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  2456. // cope with extensions
  2457. memset(MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_MIN_LEN);
  2458. }
  2459. #endif
  2460. memset(&packet2, 0, sizeof(packet2));
  2461. mavlink_msg_global_position_int_cov_encode(system_id, component_id, &msg, &packet1);
  2462. mavlink_msg_global_position_int_cov_decode(&msg, &packet2);
  2463. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2464. memset(&packet2, 0, sizeof(packet2));
  2465. mavlink_msg_global_position_int_cov_pack(system_id, component_id, &msg , packet1.time_usec , packet1.estimator_type , packet1.lat , packet1.lon , packet1.alt , packet1.relative_alt , packet1.vx , packet1.vy , packet1.vz , packet1.covariance );
  2466. mavlink_msg_global_position_int_cov_decode(&msg, &packet2);
  2467. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2468. memset(&packet2, 0, sizeof(packet2));
  2469. mavlink_msg_global_position_int_cov_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.estimator_type , packet1.lat , packet1.lon , packet1.alt , packet1.relative_alt , packet1.vx , packet1.vy , packet1.vz , packet1.covariance );
  2470. mavlink_msg_global_position_int_cov_decode(&msg, &packet2);
  2471. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2472. memset(&packet2, 0, sizeof(packet2));
  2473. mavlink_msg_to_send_buffer(buffer, &msg);
  2474. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  2475. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  2476. }
  2477. mavlink_msg_global_position_int_cov_decode(last_msg, &packet2);
  2478. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2479. memset(&packet2, 0, sizeof(packet2));
  2480. mavlink_msg_global_position_int_cov_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.estimator_type , packet1.lat , packet1.lon , packet1.alt , packet1.relative_alt , packet1.vx , packet1.vy , packet1.vz , packet1.covariance );
  2481. mavlink_msg_global_position_int_cov_decode(last_msg, &packet2);
  2482. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2483. }
  2484. static void mavlink_test_local_position_ned_cov(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  2485. {
  2486. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  2487. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  2488. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV >= 256) {
  2489. return;
  2490. }
  2491. #endif
  2492. mavlink_message_t msg;
  2493. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  2494. uint16_t i;
  2495. mavlink_local_position_ned_cov_t packet_in = {
  2496. 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0,241.0,269.0,297.0,{ 325.0, 326.0, 327.0, 328.0, 329.0, 330.0, 331.0, 332.0, 333.0, 334.0, 335.0, 336.0, 337.0, 338.0, 339.0, 340.0, 341.0, 342.0, 343.0, 344.0, 345.0, 346.0, 347.0, 348.0, 349.0, 350.0, 351.0, 352.0, 353.0, 354.0, 355.0, 356.0, 357.0, 358.0, 359.0, 360.0, 361.0, 362.0, 363.0, 364.0, 365.0, 366.0, 367.0, 368.0, 369.0 },165
  2497. };
  2498. mavlink_local_position_ned_cov_t packet1, packet2;
  2499. memset(&packet1, 0, sizeof(packet1));
  2500. packet1.time_usec = packet_in.time_usec;
  2501. packet1.x = packet_in.x;
  2502. packet1.y = packet_in.y;
  2503. packet1.z = packet_in.z;
  2504. packet1.vx = packet_in.vx;
  2505. packet1.vy = packet_in.vy;
  2506. packet1.vz = packet_in.vz;
  2507. packet1.ax = packet_in.ax;
  2508. packet1.ay = packet_in.ay;
  2509. packet1.az = packet_in.az;
  2510. packet1.estimator_type = packet_in.estimator_type;
  2511. mav_array_memcpy(packet1.covariance, packet_in.covariance, sizeof(float)*45);
  2512. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  2513. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  2514. // cope with extensions
  2515. memset(MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_MIN_LEN);
  2516. }
  2517. #endif
  2518. memset(&packet2, 0, sizeof(packet2));
  2519. mavlink_msg_local_position_ned_cov_encode(system_id, component_id, &msg, &packet1);
  2520. mavlink_msg_local_position_ned_cov_decode(&msg, &packet2);
  2521. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2522. memset(&packet2, 0, sizeof(packet2));
  2523. mavlink_msg_local_position_ned_cov_pack(system_id, component_id, &msg , packet1.time_usec , packet1.estimator_type , packet1.x , packet1.y , packet1.z , packet1.vx , packet1.vy , packet1.vz , packet1.ax , packet1.ay , packet1.az , packet1.covariance );
  2524. mavlink_msg_local_position_ned_cov_decode(&msg, &packet2);
  2525. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2526. memset(&packet2, 0, sizeof(packet2));
  2527. mavlink_msg_local_position_ned_cov_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.estimator_type , packet1.x , packet1.y , packet1.z , packet1.vx , packet1.vy , packet1.vz , packet1.ax , packet1.ay , packet1.az , packet1.covariance );
  2528. mavlink_msg_local_position_ned_cov_decode(&msg, &packet2);
  2529. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2530. memset(&packet2, 0, sizeof(packet2));
  2531. mavlink_msg_to_send_buffer(buffer, &msg);
  2532. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  2533. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  2534. }
  2535. mavlink_msg_local_position_ned_cov_decode(last_msg, &packet2);
  2536. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2537. memset(&packet2, 0, sizeof(packet2));
  2538. mavlink_msg_local_position_ned_cov_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.estimator_type , packet1.x , packet1.y , packet1.z , packet1.vx , packet1.vy , packet1.vz , packet1.ax , packet1.ay , packet1.az , packet1.covariance );
  2539. mavlink_msg_local_position_ned_cov_decode(last_msg, &packet2);
  2540. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2541. }
  2542. static void mavlink_test_rc_channels(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  2543. {
  2544. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  2545. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  2546. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_RC_CHANNELS >= 256) {
  2547. return;
  2548. }
  2549. #endif
  2550. mavlink_message_t msg;
  2551. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  2552. uint16_t i;
  2553. mavlink_rc_channels_t packet_in = {
  2554. 963497464,17443,17547,17651,17755,17859,17963,18067,18171,18275,18379,18483,18587,18691,18795,18899,19003,19107,19211,125,192
  2555. };
  2556. mavlink_rc_channels_t packet1, packet2;
  2557. memset(&packet1, 0, sizeof(packet1));
  2558. packet1.time_boot_ms = packet_in.time_boot_ms;
  2559. packet1.chan1_raw = packet_in.chan1_raw;
  2560. packet1.chan2_raw = packet_in.chan2_raw;
  2561. packet1.chan3_raw = packet_in.chan3_raw;
  2562. packet1.chan4_raw = packet_in.chan4_raw;
  2563. packet1.chan5_raw = packet_in.chan5_raw;
  2564. packet1.chan6_raw = packet_in.chan6_raw;
  2565. packet1.chan7_raw = packet_in.chan7_raw;
  2566. packet1.chan8_raw = packet_in.chan8_raw;
  2567. packet1.chan9_raw = packet_in.chan9_raw;
  2568. packet1.chan10_raw = packet_in.chan10_raw;
  2569. packet1.chan11_raw = packet_in.chan11_raw;
  2570. packet1.chan12_raw = packet_in.chan12_raw;
  2571. packet1.chan13_raw = packet_in.chan13_raw;
  2572. packet1.chan14_raw = packet_in.chan14_raw;
  2573. packet1.chan15_raw = packet_in.chan15_raw;
  2574. packet1.chan16_raw = packet_in.chan16_raw;
  2575. packet1.chan17_raw = packet_in.chan17_raw;
  2576. packet1.chan18_raw = packet_in.chan18_raw;
  2577. packet1.chancount = packet_in.chancount;
  2578. packet1.rssi = packet_in.rssi;
  2579. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  2580. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  2581. // cope with extensions
  2582. memset(MAVLINK_MSG_ID_RC_CHANNELS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_RC_CHANNELS_MIN_LEN);
  2583. }
  2584. #endif
  2585. memset(&packet2, 0, sizeof(packet2));
  2586. mavlink_msg_rc_channels_encode(system_id, component_id, &msg, &packet1);
  2587. mavlink_msg_rc_channels_decode(&msg, &packet2);
  2588. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2589. memset(&packet2, 0, sizeof(packet2));
  2590. mavlink_msg_rc_channels_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.chancount , packet1.chan1_raw , packet1.chan2_raw , packet1.chan3_raw , packet1.chan4_raw , packet1.chan5_raw , packet1.chan6_raw , packet1.chan7_raw , packet1.chan8_raw , packet1.chan9_raw , packet1.chan10_raw , packet1.chan11_raw , packet1.chan12_raw , packet1.chan13_raw , packet1.chan14_raw , packet1.chan15_raw , packet1.chan16_raw , packet1.chan17_raw , packet1.chan18_raw , packet1.rssi );
  2591. mavlink_msg_rc_channels_decode(&msg, &packet2);
  2592. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2593. memset(&packet2, 0, sizeof(packet2));
  2594. mavlink_msg_rc_channels_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.chancount , packet1.chan1_raw , packet1.chan2_raw , packet1.chan3_raw , packet1.chan4_raw , packet1.chan5_raw , packet1.chan6_raw , packet1.chan7_raw , packet1.chan8_raw , packet1.chan9_raw , packet1.chan10_raw , packet1.chan11_raw , packet1.chan12_raw , packet1.chan13_raw , packet1.chan14_raw , packet1.chan15_raw , packet1.chan16_raw , packet1.chan17_raw , packet1.chan18_raw , packet1.rssi );
  2595. mavlink_msg_rc_channels_decode(&msg, &packet2);
  2596. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2597. memset(&packet2, 0, sizeof(packet2));
  2598. mavlink_msg_to_send_buffer(buffer, &msg);
  2599. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  2600. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  2601. }
  2602. mavlink_msg_rc_channels_decode(last_msg, &packet2);
  2603. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2604. memset(&packet2, 0, sizeof(packet2));
  2605. mavlink_msg_rc_channels_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.chancount , packet1.chan1_raw , packet1.chan2_raw , packet1.chan3_raw , packet1.chan4_raw , packet1.chan5_raw , packet1.chan6_raw , packet1.chan7_raw , packet1.chan8_raw , packet1.chan9_raw , packet1.chan10_raw , packet1.chan11_raw , packet1.chan12_raw , packet1.chan13_raw , packet1.chan14_raw , packet1.chan15_raw , packet1.chan16_raw , packet1.chan17_raw , packet1.chan18_raw , packet1.rssi );
  2606. mavlink_msg_rc_channels_decode(last_msg, &packet2);
  2607. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2608. }
  2609. static void mavlink_test_request_data_stream(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  2610. {
  2611. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  2612. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  2613. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_REQUEST_DATA_STREAM >= 256) {
  2614. return;
  2615. }
  2616. #endif
  2617. mavlink_message_t msg;
  2618. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  2619. uint16_t i;
  2620. mavlink_request_data_stream_t packet_in = {
  2621. 17235,139,206,17,84
  2622. };
  2623. mavlink_request_data_stream_t packet1, packet2;
  2624. memset(&packet1, 0, sizeof(packet1));
  2625. packet1.req_message_rate = packet_in.req_message_rate;
  2626. packet1.target_system = packet_in.target_system;
  2627. packet1.target_component = packet_in.target_component;
  2628. packet1.req_stream_id = packet_in.req_stream_id;
  2629. packet1.start_stop = packet_in.start_stop;
  2630. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  2631. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  2632. // cope with extensions
  2633. memset(MAVLINK_MSG_ID_REQUEST_DATA_STREAM_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_REQUEST_DATA_STREAM_MIN_LEN);
  2634. }
  2635. #endif
  2636. memset(&packet2, 0, sizeof(packet2));
  2637. mavlink_msg_request_data_stream_encode(system_id, component_id, &msg, &packet1);
  2638. mavlink_msg_request_data_stream_decode(&msg, &packet2);
  2639. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2640. memset(&packet2, 0, sizeof(packet2));
  2641. mavlink_msg_request_data_stream_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.req_stream_id , packet1.req_message_rate , packet1.start_stop );
  2642. mavlink_msg_request_data_stream_decode(&msg, &packet2);
  2643. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2644. memset(&packet2, 0, sizeof(packet2));
  2645. mavlink_msg_request_data_stream_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.req_stream_id , packet1.req_message_rate , packet1.start_stop );
  2646. mavlink_msg_request_data_stream_decode(&msg, &packet2);
  2647. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2648. memset(&packet2, 0, sizeof(packet2));
  2649. mavlink_msg_to_send_buffer(buffer, &msg);
  2650. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  2651. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  2652. }
  2653. mavlink_msg_request_data_stream_decode(last_msg, &packet2);
  2654. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2655. memset(&packet2, 0, sizeof(packet2));
  2656. mavlink_msg_request_data_stream_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.req_stream_id , packet1.req_message_rate , packet1.start_stop );
  2657. mavlink_msg_request_data_stream_decode(last_msg, &packet2);
  2658. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2659. }
  2660. static void mavlink_test_data_stream(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  2661. {
  2662. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  2663. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  2664. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_DATA_STREAM >= 256) {
  2665. return;
  2666. }
  2667. #endif
  2668. mavlink_message_t msg;
  2669. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  2670. uint16_t i;
  2671. mavlink_data_stream_t packet_in = {
  2672. 17235,139,206
  2673. };
  2674. mavlink_data_stream_t packet1, packet2;
  2675. memset(&packet1, 0, sizeof(packet1));
  2676. packet1.message_rate = packet_in.message_rate;
  2677. packet1.stream_id = packet_in.stream_id;
  2678. packet1.on_off = packet_in.on_off;
  2679. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  2680. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  2681. // cope with extensions
  2682. memset(MAVLINK_MSG_ID_DATA_STREAM_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_DATA_STREAM_MIN_LEN);
  2683. }
  2684. #endif
  2685. memset(&packet2, 0, sizeof(packet2));
  2686. mavlink_msg_data_stream_encode(system_id, component_id, &msg, &packet1);
  2687. mavlink_msg_data_stream_decode(&msg, &packet2);
  2688. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2689. memset(&packet2, 0, sizeof(packet2));
  2690. mavlink_msg_data_stream_pack(system_id, component_id, &msg , packet1.stream_id , packet1.message_rate , packet1.on_off );
  2691. mavlink_msg_data_stream_decode(&msg, &packet2);
  2692. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2693. memset(&packet2, 0, sizeof(packet2));
  2694. mavlink_msg_data_stream_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.stream_id , packet1.message_rate , packet1.on_off );
  2695. mavlink_msg_data_stream_decode(&msg, &packet2);
  2696. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2697. memset(&packet2, 0, sizeof(packet2));
  2698. mavlink_msg_to_send_buffer(buffer, &msg);
  2699. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  2700. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  2701. }
  2702. mavlink_msg_data_stream_decode(last_msg, &packet2);
  2703. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2704. memset(&packet2, 0, sizeof(packet2));
  2705. mavlink_msg_data_stream_send(MAVLINK_COMM_1 , packet1.stream_id , packet1.message_rate , packet1.on_off );
  2706. mavlink_msg_data_stream_decode(last_msg, &packet2);
  2707. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2708. }
  2709. static void mavlink_test_manual_control(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  2710. {
  2711. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  2712. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  2713. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MANUAL_CONTROL >= 256) {
  2714. return;
  2715. }
  2716. #endif
  2717. mavlink_message_t msg;
  2718. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  2719. uint16_t i;
  2720. mavlink_manual_control_t packet_in = {
  2721. 17235,17339,17443,17547,17651,163
  2722. };
  2723. mavlink_manual_control_t packet1, packet2;
  2724. memset(&packet1, 0, sizeof(packet1));
  2725. packet1.x = packet_in.x;
  2726. packet1.y = packet_in.y;
  2727. packet1.z = packet_in.z;
  2728. packet1.r = packet_in.r;
  2729. packet1.buttons = packet_in.buttons;
  2730. packet1.target = packet_in.target;
  2731. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  2732. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  2733. // cope with extensions
  2734. memset(MAVLINK_MSG_ID_MANUAL_CONTROL_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MANUAL_CONTROL_MIN_LEN);
  2735. }
  2736. #endif
  2737. memset(&packet2, 0, sizeof(packet2));
  2738. mavlink_msg_manual_control_encode(system_id, component_id, &msg, &packet1);
  2739. mavlink_msg_manual_control_decode(&msg, &packet2);
  2740. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2741. memset(&packet2, 0, sizeof(packet2));
  2742. mavlink_msg_manual_control_pack(system_id, component_id, &msg , packet1.target , packet1.x , packet1.y , packet1.z , packet1.r , packet1.buttons );
  2743. mavlink_msg_manual_control_decode(&msg, &packet2);
  2744. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2745. memset(&packet2, 0, sizeof(packet2));
  2746. mavlink_msg_manual_control_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target , packet1.x , packet1.y , packet1.z , packet1.r , packet1.buttons );
  2747. mavlink_msg_manual_control_decode(&msg, &packet2);
  2748. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2749. memset(&packet2, 0, sizeof(packet2));
  2750. mavlink_msg_to_send_buffer(buffer, &msg);
  2751. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  2752. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  2753. }
  2754. mavlink_msg_manual_control_decode(last_msg, &packet2);
  2755. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2756. memset(&packet2, 0, sizeof(packet2));
  2757. mavlink_msg_manual_control_send(MAVLINK_COMM_1 , packet1.target , packet1.x , packet1.y , packet1.z , packet1.r , packet1.buttons );
  2758. mavlink_msg_manual_control_decode(last_msg, &packet2);
  2759. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2760. }
  2761. static void mavlink_test_rc_channels_override(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  2762. {
  2763. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  2764. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  2765. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE >= 256) {
  2766. return;
  2767. }
  2768. #endif
  2769. mavlink_message_t msg;
  2770. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  2771. uint16_t i;
  2772. mavlink_rc_channels_override_t packet_in = {
  2773. 17235,17339,17443,17547,17651,17755,17859,17963,53,120,18171,18275,18379,18483,18587,18691,18795,18899,19003,19107
  2774. };
  2775. mavlink_rc_channels_override_t packet1, packet2;
  2776. memset(&packet1, 0, sizeof(packet1));
  2777. packet1.chan1_raw = packet_in.chan1_raw;
  2778. packet1.chan2_raw = packet_in.chan2_raw;
  2779. packet1.chan3_raw = packet_in.chan3_raw;
  2780. packet1.chan4_raw = packet_in.chan4_raw;
  2781. packet1.chan5_raw = packet_in.chan5_raw;
  2782. packet1.chan6_raw = packet_in.chan6_raw;
  2783. packet1.chan7_raw = packet_in.chan7_raw;
  2784. packet1.chan8_raw = packet_in.chan8_raw;
  2785. packet1.target_system = packet_in.target_system;
  2786. packet1.target_component = packet_in.target_component;
  2787. packet1.chan9_raw = packet_in.chan9_raw;
  2788. packet1.chan10_raw = packet_in.chan10_raw;
  2789. packet1.chan11_raw = packet_in.chan11_raw;
  2790. packet1.chan12_raw = packet_in.chan12_raw;
  2791. packet1.chan13_raw = packet_in.chan13_raw;
  2792. packet1.chan14_raw = packet_in.chan14_raw;
  2793. packet1.chan15_raw = packet_in.chan15_raw;
  2794. packet1.chan16_raw = packet_in.chan16_raw;
  2795. packet1.chan17_raw = packet_in.chan17_raw;
  2796. packet1.chan18_raw = packet_in.chan18_raw;
  2797. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  2798. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  2799. // cope with extensions
  2800. memset(MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE_MIN_LEN);
  2801. }
  2802. #endif
  2803. memset(&packet2, 0, sizeof(packet2));
  2804. mavlink_msg_rc_channels_override_encode(system_id, component_id, &msg, &packet1);
  2805. mavlink_msg_rc_channels_override_decode(&msg, &packet2);
  2806. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2807. memset(&packet2, 0, sizeof(packet2));
  2808. mavlink_msg_rc_channels_override_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.chan1_raw , packet1.chan2_raw , packet1.chan3_raw , packet1.chan4_raw , packet1.chan5_raw , packet1.chan6_raw , packet1.chan7_raw , packet1.chan8_raw , packet1.chan9_raw , packet1.chan10_raw , packet1.chan11_raw , packet1.chan12_raw , packet1.chan13_raw , packet1.chan14_raw , packet1.chan15_raw , packet1.chan16_raw , packet1.chan17_raw , packet1.chan18_raw );
  2809. mavlink_msg_rc_channels_override_decode(&msg, &packet2);
  2810. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2811. memset(&packet2, 0, sizeof(packet2));
  2812. mavlink_msg_rc_channels_override_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.chan1_raw , packet1.chan2_raw , packet1.chan3_raw , packet1.chan4_raw , packet1.chan5_raw , packet1.chan6_raw , packet1.chan7_raw , packet1.chan8_raw , packet1.chan9_raw , packet1.chan10_raw , packet1.chan11_raw , packet1.chan12_raw , packet1.chan13_raw , packet1.chan14_raw , packet1.chan15_raw , packet1.chan16_raw , packet1.chan17_raw , packet1.chan18_raw );
  2813. mavlink_msg_rc_channels_override_decode(&msg, &packet2);
  2814. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2815. memset(&packet2, 0, sizeof(packet2));
  2816. mavlink_msg_to_send_buffer(buffer, &msg);
  2817. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  2818. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  2819. }
  2820. mavlink_msg_rc_channels_override_decode(last_msg, &packet2);
  2821. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2822. memset(&packet2, 0, sizeof(packet2));
  2823. mavlink_msg_rc_channels_override_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.chan1_raw , packet1.chan2_raw , packet1.chan3_raw , packet1.chan4_raw , packet1.chan5_raw , packet1.chan6_raw , packet1.chan7_raw , packet1.chan8_raw , packet1.chan9_raw , packet1.chan10_raw , packet1.chan11_raw , packet1.chan12_raw , packet1.chan13_raw , packet1.chan14_raw , packet1.chan15_raw , packet1.chan16_raw , packet1.chan17_raw , packet1.chan18_raw );
  2824. mavlink_msg_rc_channels_override_decode(last_msg, &packet2);
  2825. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2826. }
  2827. static void mavlink_test_mission_item_int(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  2828. {
  2829. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  2830. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  2831. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MISSION_ITEM_INT >= 256) {
  2832. return;
  2833. }
  2834. #endif
  2835. mavlink_message_t msg;
  2836. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  2837. uint16_t i;
  2838. mavlink_mission_item_int_t packet_in = {
  2839. 17.0,45.0,73.0,101.0,963498296,963498504,185.0,18691,18795,101,168,235,46,113,180
  2840. };
  2841. mavlink_mission_item_int_t packet1, packet2;
  2842. memset(&packet1, 0, sizeof(packet1));
  2843. packet1.param1 = packet_in.param1;
  2844. packet1.param2 = packet_in.param2;
  2845. packet1.param3 = packet_in.param3;
  2846. packet1.param4 = packet_in.param4;
  2847. packet1.x = packet_in.x;
  2848. packet1.y = packet_in.y;
  2849. packet1.z = packet_in.z;
  2850. packet1.seq = packet_in.seq;
  2851. packet1.command = packet_in.command;
  2852. packet1.target_system = packet_in.target_system;
  2853. packet1.target_component = packet_in.target_component;
  2854. packet1.frame = packet_in.frame;
  2855. packet1.current = packet_in.current;
  2856. packet1.autocontinue = packet_in.autocontinue;
  2857. packet1.mission_type = packet_in.mission_type;
  2858. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  2859. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  2860. // cope with extensions
  2861. memset(MAVLINK_MSG_ID_MISSION_ITEM_INT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MISSION_ITEM_INT_MIN_LEN);
  2862. }
  2863. #endif
  2864. memset(&packet2, 0, sizeof(packet2));
  2865. mavlink_msg_mission_item_int_encode(system_id, component_id, &msg, &packet1);
  2866. mavlink_msg_mission_item_int_decode(&msg, &packet2);
  2867. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2868. memset(&packet2, 0, sizeof(packet2));
  2869. mavlink_msg_mission_item_int_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.seq , packet1.frame , packet1.command , packet1.current , packet1.autocontinue , packet1.param1 , packet1.param2 , packet1.param3 , packet1.param4 , packet1.x , packet1.y , packet1.z , packet1.mission_type );
  2870. mavlink_msg_mission_item_int_decode(&msg, &packet2);
  2871. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2872. memset(&packet2, 0, sizeof(packet2));
  2873. mavlink_msg_mission_item_int_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.seq , packet1.frame , packet1.command , packet1.current , packet1.autocontinue , packet1.param1 , packet1.param2 , packet1.param3 , packet1.param4 , packet1.x , packet1.y , packet1.z , packet1.mission_type );
  2874. mavlink_msg_mission_item_int_decode(&msg, &packet2);
  2875. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2876. memset(&packet2, 0, sizeof(packet2));
  2877. mavlink_msg_to_send_buffer(buffer, &msg);
  2878. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  2879. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  2880. }
  2881. mavlink_msg_mission_item_int_decode(last_msg, &packet2);
  2882. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2883. memset(&packet2, 0, sizeof(packet2));
  2884. mavlink_msg_mission_item_int_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.seq , packet1.frame , packet1.command , packet1.current , packet1.autocontinue , packet1.param1 , packet1.param2 , packet1.param3 , packet1.param4 , packet1.x , packet1.y , packet1.z , packet1.mission_type );
  2885. mavlink_msg_mission_item_int_decode(last_msg, &packet2);
  2886. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2887. }
  2888. static void mavlink_test_vfr_hud(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  2889. {
  2890. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  2891. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  2892. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_VFR_HUD >= 256) {
  2893. return;
  2894. }
  2895. #endif
  2896. mavlink_message_t msg;
  2897. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  2898. uint16_t i;
  2899. mavlink_vfr_hud_t packet_in = {
  2900. 17.0,45.0,73.0,101.0,18067,18171
  2901. };
  2902. mavlink_vfr_hud_t packet1, packet2;
  2903. memset(&packet1, 0, sizeof(packet1));
  2904. packet1.airspeed = packet_in.airspeed;
  2905. packet1.groundspeed = packet_in.groundspeed;
  2906. packet1.alt = packet_in.alt;
  2907. packet1.climb = packet_in.climb;
  2908. packet1.heading = packet_in.heading;
  2909. packet1.throttle = packet_in.throttle;
  2910. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  2911. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  2912. // cope with extensions
  2913. memset(MAVLINK_MSG_ID_VFR_HUD_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_VFR_HUD_MIN_LEN);
  2914. }
  2915. #endif
  2916. memset(&packet2, 0, sizeof(packet2));
  2917. mavlink_msg_vfr_hud_encode(system_id, component_id, &msg, &packet1);
  2918. mavlink_msg_vfr_hud_decode(&msg, &packet2);
  2919. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2920. memset(&packet2, 0, sizeof(packet2));
  2921. mavlink_msg_vfr_hud_pack(system_id, component_id, &msg , packet1.airspeed , packet1.groundspeed , packet1.heading , packet1.throttle , packet1.alt , packet1.climb );
  2922. mavlink_msg_vfr_hud_decode(&msg, &packet2);
  2923. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2924. memset(&packet2, 0, sizeof(packet2));
  2925. mavlink_msg_vfr_hud_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.airspeed , packet1.groundspeed , packet1.heading , packet1.throttle , packet1.alt , packet1.climb );
  2926. mavlink_msg_vfr_hud_decode(&msg, &packet2);
  2927. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2928. memset(&packet2, 0, sizeof(packet2));
  2929. mavlink_msg_to_send_buffer(buffer, &msg);
  2930. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  2931. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  2932. }
  2933. mavlink_msg_vfr_hud_decode(last_msg, &packet2);
  2934. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2935. memset(&packet2, 0, sizeof(packet2));
  2936. mavlink_msg_vfr_hud_send(MAVLINK_COMM_1 , packet1.airspeed , packet1.groundspeed , packet1.heading , packet1.throttle , packet1.alt , packet1.climb );
  2937. mavlink_msg_vfr_hud_decode(last_msg, &packet2);
  2938. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2939. }
  2940. static void mavlink_test_command_int(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  2941. {
  2942. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  2943. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  2944. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_COMMAND_INT >= 256) {
  2945. return;
  2946. }
  2947. #endif
  2948. mavlink_message_t msg;
  2949. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  2950. uint16_t i;
  2951. mavlink_command_int_t packet_in = {
  2952. 17.0,45.0,73.0,101.0,963498296,963498504,185.0,18691,223,34,101,168,235
  2953. };
  2954. mavlink_command_int_t packet1, packet2;
  2955. memset(&packet1, 0, sizeof(packet1));
  2956. packet1.param1 = packet_in.param1;
  2957. packet1.param2 = packet_in.param2;
  2958. packet1.param3 = packet_in.param3;
  2959. packet1.param4 = packet_in.param4;
  2960. packet1.x = packet_in.x;
  2961. packet1.y = packet_in.y;
  2962. packet1.z = packet_in.z;
  2963. packet1.command = packet_in.command;
  2964. packet1.target_system = packet_in.target_system;
  2965. packet1.target_component = packet_in.target_component;
  2966. packet1.frame = packet_in.frame;
  2967. packet1.current = packet_in.current;
  2968. packet1.autocontinue = packet_in.autocontinue;
  2969. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  2970. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  2971. // cope with extensions
  2972. memset(MAVLINK_MSG_ID_COMMAND_INT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_COMMAND_INT_MIN_LEN);
  2973. }
  2974. #endif
  2975. memset(&packet2, 0, sizeof(packet2));
  2976. mavlink_msg_command_int_encode(system_id, component_id, &msg, &packet1);
  2977. mavlink_msg_command_int_decode(&msg, &packet2);
  2978. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2979. memset(&packet2, 0, sizeof(packet2));
  2980. mavlink_msg_command_int_pack(system_id, component_id, &msg , 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 );
  2981. mavlink_msg_command_int_decode(&msg, &packet2);
  2982. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2983. memset(&packet2, 0, sizeof(packet2));
  2984. mavlink_msg_command_int_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , 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 );
  2985. mavlink_msg_command_int_decode(&msg, &packet2);
  2986. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2987. memset(&packet2, 0, sizeof(packet2));
  2988. mavlink_msg_to_send_buffer(buffer, &msg);
  2989. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  2990. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  2991. }
  2992. mavlink_msg_command_int_decode(last_msg, &packet2);
  2993. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2994. memset(&packet2, 0, sizeof(packet2));
  2995. mavlink_msg_command_int_send(MAVLINK_COMM_1 , 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 );
  2996. mavlink_msg_command_int_decode(last_msg, &packet2);
  2997. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  2998. }
  2999. static void mavlink_test_command_long(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  3000. {
  3001. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  3002. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  3003. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_COMMAND_LONG >= 256) {
  3004. return;
  3005. }
  3006. #endif
  3007. mavlink_message_t msg;
  3008. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  3009. uint16_t i;
  3010. mavlink_command_long_t packet_in = {
  3011. 17.0,45.0,73.0,101.0,129.0,157.0,185.0,18691,223,34,101
  3012. };
  3013. mavlink_command_long_t packet1, packet2;
  3014. memset(&packet1, 0, sizeof(packet1));
  3015. packet1.param1 = packet_in.param1;
  3016. packet1.param2 = packet_in.param2;
  3017. packet1.param3 = packet_in.param3;
  3018. packet1.param4 = packet_in.param4;
  3019. packet1.param5 = packet_in.param5;
  3020. packet1.param6 = packet_in.param6;
  3021. packet1.param7 = packet_in.param7;
  3022. packet1.command = packet_in.command;
  3023. packet1.target_system = packet_in.target_system;
  3024. packet1.target_component = packet_in.target_component;
  3025. packet1.confirmation = packet_in.confirmation;
  3026. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  3027. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  3028. // cope with extensions
  3029. memset(MAVLINK_MSG_ID_COMMAND_LONG_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_COMMAND_LONG_MIN_LEN);
  3030. }
  3031. #endif
  3032. memset(&packet2, 0, sizeof(packet2));
  3033. mavlink_msg_command_long_encode(system_id, component_id, &msg, &packet1);
  3034. mavlink_msg_command_long_decode(&msg, &packet2);
  3035. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3036. memset(&packet2, 0, sizeof(packet2));
  3037. mavlink_msg_command_long_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.command , packet1.confirmation , packet1.param1 , packet1.param2 , packet1.param3 , packet1.param4 , packet1.param5 , packet1.param6 , packet1.param7 );
  3038. mavlink_msg_command_long_decode(&msg, &packet2);
  3039. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3040. memset(&packet2, 0, sizeof(packet2));
  3041. mavlink_msg_command_long_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.command , packet1.confirmation , packet1.param1 , packet1.param2 , packet1.param3 , packet1.param4 , packet1.param5 , packet1.param6 , packet1.param7 );
  3042. mavlink_msg_command_long_decode(&msg, &packet2);
  3043. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3044. memset(&packet2, 0, sizeof(packet2));
  3045. mavlink_msg_to_send_buffer(buffer, &msg);
  3046. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  3047. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  3048. }
  3049. mavlink_msg_command_long_decode(last_msg, &packet2);
  3050. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3051. memset(&packet2, 0, sizeof(packet2));
  3052. mavlink_msg_command_long_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.command , packet1.confirmation , packet1.param1 , packet1.param2 , packet1.param3 , packet1.param4 , packet1.param5 , packet1.param6 , packet1.param7 );
  3053. mavlink_msg_command_long_decode(last_msg, &packet2);
  3054. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3055. }
  3056. static void mavlink_test_command_ack(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  3057. {
  3058. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  3059. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  3060. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_COMMAND_ACK >= 256) {
  3061. return;
  3062. }
  3063. #endif
  3064. mavlink_message_t msg;
  3065. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  3066. uint16_t i;
  3067. mavlink_command_ack_t packet_in = {
  3068. 17235,139,206,963497672,29,96
  3069. };
  3070. mavlink_command_ack_t packet1, packet2;
  3071. memset(&packet1, 0, sizeof(packet1));
  3072. packet1.command = packet_in.command;
  3073. packet1.result = packet_in.result;
  3074. packet1.progress = packet_in.progress;
  3075. packet1.result_param2 = packet_in.result_param2;
  3076. packet1.target_system = packet_in.target_system;
  3077. packet1.target_component = packet_in.target_component;
  3078. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  3079. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  3080. // cope with extensions
  3081. memset(MAVLINK_MSG_ID_COMMAND_ACK_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_COMMAND_ACK_MIN_LEN);
  3082. }
  3083. #endif
  3084. memset(&packet2, 0, sizeof(packet2));
  3085. mavlink_msg_command_ack_encode(system_id, component_id, &msg, &packet1);
  3086. mavlink_msg_command_ack_decode(&msg, &packet2);
  3087. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3088. memset(&packet2, 0, sizeof(packet2));
  3089. mavlink_msg_command_ack_pack(system_id, component_id, &msg , packet1.command , packet1.result , packet1.progress , packet1.result_param2 , packet1.target_system , packet1.target_component );
  3090. mavlink_msg_command_ack_decode(&msg, &packet2);
  3091. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3092. memset(&packet2, 0, sizeof(packet2));
  3093. mavlink_msg_command_ack_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.command , packet1.result , packet1.progress , packet1.result_param2 , packet1.target_system , packet1.target_component );
  3094. mavlink_msg_command_ack_decode(&msg, &packet2);
  3095. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3096. memset(&packet2, 0, sizeof(packet2));
  3097. mavlink_msg_to_send_buffer(buffer, &msg);
  3098. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  3099. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  3100. }
  3101. mavlink_msg_command_ack_decode(last_msg, &packet2);
  3102. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3103. memset(&packet2, 0, sizeof(packet2));
  3104. mavlink_msg_command_ack_send(MAVLINK_COMM_1 , packet1.command , packet1.result , packet1.progress , packet1.result_param2 , packet1.target_system , packet1.target_component );
  3105. mavlink_msg_command_ack_decode(last_msg, &packet2);
  3106. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3107. }
  3108. static void mavlink_test_manual_setpoint(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  3109. {
  3110. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  3111. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  3112. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MANUAL_SETPOINT >= 256) {
  3113. return;
  3114. }
  3115. #endif
  3116. mavlink_message_t msg;
  3117. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  3118. uint16_t i;
  3119. mavlink_manual_setpoint_t packet_in = {
  3120. 963497464,45.0,73.0,101.0,129.0,65,132
  3121. };
  3122. mavlink_manual_setpoint_t packet1, packet2;
  3123. memset(&packet1, 0, sizeof(packet1));
  3124. packet1.time_boot_ms = packet_in.time_boot_ms;
  3125. packet1.roll = packet_in.roll;
  3126. packet1.pitch = packet_in.pitch;
  3127. packet1.yaw = packet_in.yaw;
  3128. packet1.thrust = packet_in.thrust;
  3129. packet1.mode_switch = packet_in.mode_switch;
  3130. packet1.manual_override_switch = packet_in.manual_override_switch;
  3131. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  3132. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  3133. // cope with extensions
  3134. memset(MAVLINK_MSG_ID_MANUAL_SETPOINT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MANUAL_SETPOINT_MIN_LEN);
  3135. }
  3136. #endif
  3137. memset(&packet2, 0, sizeof(packet2));
  3138. mavlink_msg_manual_setpoint_encode(system_id, component_id, &msg, &packet1);
  3139. mavlink_msg_manual_setpoint_decode(&msg, &packet2);
  3140. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3141. memset(&packet2, 0, sizeof(packet2));
  3142. mavlink_msg_manual_setpoint_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.roll , packet1.pitch , packet1.yaw , packet1.thrust , packet1.mode_switch , packet1.manual_override_switch );
  3143. mavlink_msg_manual_setpoint_decode(&msg, &packet2);
  3144. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3145. memset(&packet2, 0, sizeof(packet2));
  3146. mavlink_msg_manual_setpoint_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.roll , packet1.pitch , packet1.yaw , packet1.thrust , packet1.mode_switch , packet1.manual_override_switch );
  3147. mavlink_msg_manual_setpoint_decode(&msg, &packet2);
  3148. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3149. memset(&packet2, 0, sizeof(packet2));
  3150. mavlink_msg_to_send_buffer(buffer, &msg);
  3151. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  3152. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  3153. }
  3154. mavlink_msg_manual_setpoint_decode(last_msg, &packet2);
  3155. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3156. memset(&packet2, 0, sizeof(packet2));
  3157. mavlink_msg_manual_setpoint_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.roll , packet1.pitch , packet1.yaw , packet1.thrust , packet1.mode_switch , packet1.manual_override_switch );
  3158. mavlink_msg_manual_setpoint_decode(last_msg, &packet2);
  3159. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3160. }
  3161. static void mavlink_test_set_attitude_target(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  3162. {
  3163. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  3164. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  3165. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SET_ATTITUDE_TARGET >= 256) {
  3166. return;
  3167. }
  3168. #endif
  3169. mavlink_message_t msg;
  3170. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  3171. uint16_t i;
  3172. mavlink_set_attitude_target_t packet_in = {
  3173. 963497464,{ 45.0, 46.0, 47.0, 48.0 },157.0,185.0,213.0,241.0,113,180,247
  3174. };
  3175. mavlink_set_attitude_target_t packet1, packet2;
  3176. memset(&packet1, 0, sizeof(packet1));
  3177. packet1.time_boot_ms = packet_in.time_boot_ms;
  3178. packet1.body_roll_rate = packet_in.body_roll_rate;
  3179. packet1.body_pitch_rate = packet_in.body_pitch_rate;
  3180. packet1.body_yaw_rate = packet_in.body_yaw_rate;
  3181. packet1.thrust = packet_in.thrust;
  3182. packet1.target_system = packet_in.target_system;
  3183. packet1.target_component = packet_in.target_component;
  3184. packet1.type_mask = packet_in.type_mask;
  3185. mav_array_memcpy(packet1.q, packet_in.q, sizeof(float)*4);
  3186. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  3187. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  3188. // cope with extensions
  3189. memset(MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_MIN_LEN);
  3190. }
  3191. #endif
  3192. memset(&packet2, 0, sizeof(packet2));
  3193. mavlink_msg_set_attitude_target_encode(system_id, component_id, &msg, &packet1);
  3194. mavlink_msg_set_attitude_target_decode(&msg, &packet2);
  3195. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3196. memset(&packet2, 0, sizeof(packet2));
  3197. mavlink_msg_set_attitude_target_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.target_system , packet1.target_component , packet1.type_mask , packet1.q , packet1.body_roll_rate , packet1.body_pitch_rate , packet1.body_yaw_rate , packet1.thrust );
  3198. mavlink_msg_set_attitude_target_decode(&msg, &packet2);
  3199. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3200. memset(&packet2, 0, sizeof(packet2));
  3201. mavlink_msg_set_attitude_target_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.target_system , packet1.target_component , packet1.type_mask , packet1.q , packet1.body_roll_rate , packet1.body_pitch_rate , packet1.body_yaw_rate , packet1.thrust );
  3202. mavlink_msg_set_attitude_target_decode(&msg, &packet2);
  3203. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3204. memset(&packet2, 0, sizeof(packet2));
  3205. mavlink_msg_to_send_buffer(buffer, &msg);
  3206. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  3207. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  3208. }
  3209. mavlink_msg_set_attitude_target_decode(last_msg, &packet2);
  3210. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3211. memset(&packet2, 0, sizeof(packet2));
  3212. mavlink_msg_set_attitude_target_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.target_system , packet1.target_component , packet1.type_mask , packet1.q , packet1.body_roll_rate , packet1.body_pitch_rate , packet1.body_yaw_rate , packet1.thrust );
  3213. mavlink_msg_set_attitude_target_decode(last_msg, &packet2);
  3214. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3215. }
  3216. static void mavlink_test_attitude_target(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  3217. {
  3218. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  3219. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  3220. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ATTITUDE_TARGET >= 256) {
  3221. return;
  3222. }
  3223. #endif
  3224. mavlink_message_t msg;
  3225. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  3226. uint16_t i;
  3227. mavlink_attitude_target_t packet_in = {
  3228. 963497464,{ 45.0, 46.0, 47.0, 48.0 },157.0,185.0,213.0,241.0,113
  3229. };
  3230. mavlink_attitude_target_t packet1, packet2;
  3231. memset(&packet1, 0, sizeof(packet1));
  3232. packet1.time_boot_ms = packet_in.time_boot_ms;
  3233. packet1.body_roll_rate = packet_in.body_roll_rate;
  3234. packet1.body_pitch_rate = packet_in.body_pitch_rate;
  3235. packet1.body_yaw_rate = packet_in.body_yaw_rate;
  3236. packet1.thrust = packet_in.thrust;
  3237. packet1.type_mask = packet_in.type_mask;
  3238. mav_array_memcpy(packet1.q, packet_in.q, sizeof(float)*4);
  3239. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  3240. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  3241. // cope with extensions
  3242. memset(MAVLINK_MSG_ID_ATTITUDE_TARGET_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ATTITUDE_TARGET_MIN_LEN);
  3243. }
  3244. #endif
  3245. memset(&packet2, 0, sizeof(packet2));
  3246. mavlink_msg_attitude_target_encode(system_id, component_id, &msg, &packet1);
  3247. mavlink_msg_attitude_target_decode(&msg, &packet2);
  3248. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3249. memset(&packet2, 0, sizeof(packet2));
  3250. mavlink_msg_attitude_target_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.type_mask , packet1.q , packet1.body_roll_rate , packet1.body_pitch_rate , packet1.body_yaw_rate , packet1.thrust );
  3251. mavlink_msg_attitude_target_decode(&msg, &packet2);
  3252. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3253. memset(&packet2, 0, sizeof(packet2));
  3254. mavlink_msg_attitude_target_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.type_mask , packet1.q , packet1.body_roll_rate , packet1.body_pitch_rate , packet1.body_yaw_rate , packet1.thrust );
  3255. mavlink_msg_attitude_target_decode(&msg, &packet2);
  3256. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3257. memset(&packet2, 0, sizeof(packet2));
  3258. mavlink_msg_to_send_buffer(buffer, &msg);
  3259. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  3260. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  3261. }
  3262. mavlink_msg_attitude_target_decode(last_msg, &packet2);
  3263. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3264. memset(&packet2, 0, sizeof(packet2));
  3265. mavlink_msg_attitude_target_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.type_mask , packet1.q , packet1.body_roll_rate , packet1.body_pitch_rate , packet1.body_yaw_rate , packet1.thrust );
  3266. mavlink_msg_attitude_target_decode(last_msg, &packet2);
  3267. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3268. }
  3269. static void mavlink_test_set_position_target_local_ned(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  3270. {
  3271. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  3272. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  3273. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED >= 256) {
  3274. return;
  3275. }
  3276. #endif
  3277. mavlink_message_t msg;
  3278. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  3279. uint16_t i;
  3280. mavlink_set_position_target_local_ned_t packet_in = {
  3281. 963497464,45.0,73.0,101.0,129.0,157.0,185.0,213.0,241.0,269.0,297.0,325.0,19731,27,94,161
  3282. };
  3283. mavlink_set_position_target_local_ned_t packet1, packet2;
  3284. memset(&packet1, 0, sizeof(packet1));
  3285. packet1.time_boot_ms = packet_in.time_boot_ms;
  3286. packet1.x = packet_in.x;
  3287. packet1.y = packet_in.y;
  3288. packet1.z = packet_in.z;
  3289. packet1.vx = packet_in.vx;
  3290. packet1.vy = packet_in.vy;
  3291. packet1.vz = packet_in.vz;
  3292. packet1.afx = packet_in.afx;
  3293. packet1.afy = packet_in.afy;
  3294. packet1.afz = packet_in.afz;
  3295. packet1.yaw = packet_in.yaw;
  3296. packet1.yaw_rate = packet_in.yaw_rate;
  3297. packet1.type_mask = packet_in.type_mask;
  3298. packet1.target_system = packet_in.target_system;
  3299. packet1.target_component = packet_in.target_component;
  3300. packet1.coordinate_frame = packet_in.coordinate_frame;
  3301. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  3302. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  3303. // cope with extensions
  3304. memset(MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_MIN_LEN);
  3305. }
  3306. #endif
  3307. memset(&packet2, 0, sizeof(packet2));
  3308. mavlink_msg_set_position_target_local_ned_encode(system_id, component_id, &msg, &packet1);
  3309. mavlink_msg_set_position_target_local_ned_decode(&msg, &packet2);
  3310. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3311. memset(&packet2, 0, sizeof(packet2));
  3312. mavlink_msg_set_position_target_local_ned_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.target_system , packet1.target_component , packet1.coordinate_frame , packet1.type_mask , packet1.x , packet1.y , packet1.z , packet1.vx , packet1.vy , packet1.vz , packet1.afx , packet1.afy , packet1.afz , packet1.yaw , packet1.yaw_rate );
  3313. mavlink_msg_set_position_target_local_ned_decode(&msg, &packet2);
  3314. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3315. memset(&packet2, 0, sizeof(packet2));
  3316. mavlink_msg_set_position_target_local_ned_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.target_system , packet1.target_component , packet1.coordinate_frame , packet1.type_mask , packet1.x , packet1.y , packet1.z , packet1.vx , packet1.vy , packet1.vz , packet1.afx , packet1.afy , packet1.afz , packet1.yaw , packet1.yaw_rate );
  3317. mavlink_msg_set_position_target_local_ned_decode(&msg, &packet2);
  3318. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3319. memset(&packet2, 0, sizeof(packet2));
  3320. mavlink_msg_to_send_buffer(buffer, &msg);
  3321. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  3322. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  3323. }
  3324. mavlink_msg_set_position_target_local_ned_decode(last_msg, &packet2);
  3325. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3326. memset(&packet2, 0, sizeof(packet2));
  3327. mavlink_msg_set_position_target_local_ned_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.target_system , packet1.target_component , packet1.coordinate_frame , packet1.type_mask , packet1.x , packet1.y , packet1.z , packet1.vx , packet1.vy , packet1.vz , packet1.afx , packet1.afy , packet1.afz , packet1.yaw , packet1.yaw_rate );
  3328. mavlink_msg_set_position_target_local_ned_decode(last_msg, &packet2);
  3329. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3330. }
  3331. static void mavlink_test_position_target_local_ned(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  3332. {
  3333. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  3334. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  3335. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED >= 256) {
  3336. return;
  3337. }
  3338. #endif
  3339. mavlink_message_t msg;
  3340. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  3341. uint16_t i;
  3342. mavlink_position_target_local_ned_t packet_in = {
  3343. 963497464,45.0,73.0,101.0,129.0,157.0,185.0,213.0,241.0,269.0,297.0,325.0,19731,27
  3344. };
  3345. mavlink_position_target_local_ned_t packet1, packet2;
  3346. memset(&packet1, 0, sizeof(packet1));
  3347. packet1.time_boot_ms = packet_in.time_boot_ms;
  3348. packet1.x = packet_in.x;
  3349. packet1.y = packet_in.y;
  3350. packet1.z = packet_in.z;
  3351. packet1.vx = packet_in.vx;
  3352. packet1.vy = packet_in.vy;
  3353. packet1.vz = packet_in.vz;
  3354. packet1.afx = packet_in.afx;
  3355. packet1.afy = packet_in.afy;
  3356. packet1.afz = packet_in.afz;
  3357. packet1.yaw = packet_in.yaw;
  3358. packet1.yaw_rate = packet_in.yaw_rate;
  3359. packet1.type_mask = packet_in.type_mask;
  3360. packet1.coordinate_frame = packet_in.coordinate_frame;
  3361. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  3362. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  3363. // cope with extensions
  3364. memset(MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_MIN_LEN);
  3365. }
  3366. #endif
  3367. memset(&packet2, 0, sizeof(packet2));
  3368. mavlink_msg_position_target_local_ned_encode(system_id, component_id, &msg, &packet1);
  3369. mavlink_msg_position_target_local_ned_decode(&msg, &packet2);
  3370. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3371. memset(&packet2, 0, sizeof(packet2));
  3372. mavlink_msg_position_target_local_ned_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.coordinate_frame , packet1.type_mask , packet1.x , packet1.y , packet1.z , packet1.vx , packet1.vy , packet1.vz , packet1.afx , packet1.afy , packet1.afz , packet1.yaw , packet1.yaw_rate );
  3373. mavlink_msg_position_target_local_ned_decode(&msg, &packet2);
  3374. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3375. memset(&packet2, 0, sizeof(packet2));
  3376. mavlink_msg_position_target_local_ned_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.coordinate_frame , packet1.type_mask , packet1.x , packet1.y , packet1.z , packet1.vx , packet1.vy , packet1.vz , packet1.afx , packet1.afy , packet1.afz , packet1.yaw , packet1.yaw_rate );
  3377. mavlink_msg_position_target_local_ned_decode(&msg, &packet2);
  3378. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3379. memset(&packet2, 0, sizeof(packet2));
  3380. mavlink_msg_to_send_buffer(buffer, &msg);
  3381. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  3382. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  3383. }
  3384. mavlink_msg_position_target_local_ned_decode(last_msg, &packet2);
  3385. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3386. memset(&packet2, 0, sizeof(packet2));
  3387. mavlink_msg_position_target_local_ned_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.coordinate_frame , packet1.type_mask , packet1.x , packet1.y , packet1.z , packet1.vx , packet1.vy , packet1.vz , packet1.afx , packet1.afy , packet1.afz , packet1.yaw , packet1.yaw_rate );
  3388. mavlink_msg_position_target_local_ned_decode(last_msg, &packet2);
  3389. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3390. }
  3391. static void mavlink_test_set_position_target_global_int(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  3392. {
  3393. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  3394. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  3395. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SET_POSITION_TARGET_GLOBAL_INT >= 256) {
  3396. return;
  3397. }
  3398. #endif
  3399. mavlink_message_t msg;
  3400. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  3401. uint16_t i;
  3402. mavlink_set_position_target_global_int_t packet_in = {
  3403. 963497464,963497672,963497880,101.0,129.0,157.0,185.0,213.0,241.0,269.0,297.0,325.0,19731,27,94,161
  3404. };
  3405. mavlink_set_position_target_global_int_t packet1, packet2;
  3406. memset(&packet1, 0, sizeof(packet1));
  3407. packet1.time_boot_ms = packet_in.time_boot_ms;
  3408. packet1.lat_int = packet_in.lat_int;
  3409. packet1.lon_int = packet_in.lon_int;
  3410. packet1.alt = packet_in.alt;
  3411. packet1.vx = packet_in.vx;
  3412. packet1.vy = packet_in.vy;
  3413. packet1.vz = packet_in.vz;
  3414. packet1.afx = packet_in.afx;
  3415. packet1.afy = packet_in.afy;
  3416. packet1.afz = packet_in.afz;
  3417. packet1.yaw = packet_in.yaw;
  3418. packet1.yaw_rate = packet_in.yaw_rate;
  3419. packet1.type_mask = packet_in.type_mask;
  3420. packet1.target_system = packet_in.target_system;
  3421. packet1.target_component = packet_in.target_component;
  3422. packet1.coordinate_frame = packet_in.coordinate_frame;
  3423. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  3424. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  3425. // cope with extensions
  3426. memset(MAVLINK_MSG_ID_SET_POSITION_TARGET_GLOBAL_INT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SET_POSITION_TARGET_GLOBAL_INT_MIN_LEN);
  3427. }
  3428. #endif
  3429. memset(&packet2, 0, sizeof(packet2));
  3430. mavlink_msg_set_position_target_global_int_encode(system_id, component_id, &msg, &packet1);
  3431. mavlink_msg_set_position_target_global_int_decode(&msg, &packet2);
  3432. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3433. memset(&packet2, 0, sizeof(packet2));
  3434. mavlink_msg_set_position_target_global_int_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.target_system , packet1.target_component , packet1.coordinate_frame , packet1.type_mask , packet1.lat_int , packet1.lon_int , packet1.alt , packet1.vx , packet1.vy , packet1.vz , packet1.afx , packet1.afy , packet1.afz , packet1.yaw , packet1.yaw_rate );
  3435. mavlink_msg_set_position_target_global_int_decode(&msg, &packet2);
  3436. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3437. memset(&packet2, 0, sizeof(packet2));
  3438. mavlink_msg_set_position_target_global_int_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.target_system , packet1.target_component , packet1.coordinate_frame , packet1.type_mask , packet1.lat_int , packet1.lon_int , packet1.alt , packet1.vx , packet1.vy , packet1.vz , packet1.afx , packet1.afy , packet1.afz , packet1.yaw , packet1.yaw_rate );
  3439. mavlink_msg_set_position_target_global_int_decode(&msg, &packet2);
  3440. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3441. memset(&packet2, 0, sizeof(packet2));
  3442. mavlink_msg_to_send_buffer(buffer, &msg);
  3443. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  3444. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  3445. }
  3446. mavlink_msg_set_position_target_global_int_decode(last_msg, &packet2);
  3447. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3448. memset(&packet2, 0, sizeof(packet2));
  3449. mavlink_msg_set_position_target_global_int_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.target_system , packet1.target_component , packet1.coordinate_frame , packet1.type_mask , packet1.lat_int , packet1.lon_int , packet1.alt , packet1.vx , packet1.vy , packet1.vz , packet1.afx , packet1.afy , packet1.afz , packet1.yaw , packet1.yaw_rate );
  3450. mavlink_msg_set_position_target_global_int_decode(last_msg, &packet2);
  3451. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3452. }
  3453. static void mavlink_test_position_target_global_int(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  3454. {
  3455. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  3456. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  3457. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT >= 256) {
  3458. return;
  3459. }
  3460. #endif
  3461. mavlink_message_t msg;
  3462. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  3463. uint16_t i;
  3464. mavlink_position_target_global_int_t packet_in = {
  3465. 963497464,963497672,963497880,101.0,129.0,157.0,185.0,213.0,241.0,269.0,297.0,325.0,19731,27
  3466. };
  3467. mavlink_position_target_global_int_t packet1, packet2;
  3468. memset(&packet1, 0, sizeof(packet1));
  3469. packet1.time_boot_ms = packet_in.time_boot_ms;
  3470. packet1.lat_int = packet_in.lat_int;
  3471. packet1.lon_int = packet_in.lon_int;
  3472. packet1.alt = packet_in.alt;
  3473. packet1.vx = packet_in.vx;
  3474. packet1.vy = packet_in.vy;
  3475. packet1.vz = packet_in.vz;
  3476. packet1.afx = packet_in.afx;
  3477. packet1.afy = packet_in.afy;
  3478. packet1.afz = packet_in.afz;
  3479. packet1.yaw = packet_in.yaw;
  3480. packet1.yaw_rate = packet_in.yaw_rate;
  3481. packet1.type_mask = packet_in.type_mask;
  3482. packet1.coordinate_frame = packet_in.coordinate_frame;
  3483. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  3484. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  3485. // cope with extensions
  3486. memset(MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_MIN_LEN);
  3487. }
  3488. #endif
  3489. memset(&packet2, 0, sizeof(packet2));
  3490. mavlink_msg_position_target_global_int_encode(system_id, component_id, &msg, &packet1);
  3491. mavlink_msg_position_target_global_int_decode(&msg, &packet2);
  3492. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3493. memset(&packet2, 0, sizeof(packet2));
  3494. mavlink_msg_position_target_global_int_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.coordinate_frame , packet1.type_mask , packet1.lat_int , packet1.lon_int , packet1.alt , packet1.vx , packet1.vy , packet1.vz , packet1.afx , packet1.afy , packet1.afz , packet1.yaw , packet1.yaw_rate );
  3495. mavlink_msg_position_target_global_int_decode(&msg, &packet2);
  3496. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3497. memset(&packet2, 0, sizeof(packet2));
  3498. mavlink_msg_position_target_global_int_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.coordinate_frame , packet1.type_mask , packet1.lat_int , packet1.lon_int , packet1.alt , packet1.vx , packet1.vy , packet1.vz , packet1.afx , packet1.afy , packet1.afz , packet1.yaw , packet1.yaw_rate );
  3499. mavlink_msg_position_target_global_int_decode(&msg, &packet2);
  3500. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3501. memset(&packet2, 0, sizeof(packet2));
  3502. mavlink_msg_to_send_buffer(buffer, &msg);
  3503. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  3504. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  3505. }
  3506. mavlink_msg_position_target_global_int_decode(last_msg, &packet2);
  3507. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3508. memset(&packet2, 0, sizeof(packet2));
  3509. mavlink_msg_position_target_global_int_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.coordinate_frame , packet1.type_mask , packet1.lat_int , packet1.lon_int , packet1.alt , packet1.vx , packet1.vy , packet1.vz , packet1.afx , packet1.afy , packet1.afz , packet1.yaw , packet1.yaw_rate );
  3510. mavlink_msg_position_target_global_int_decode(last_msg, &packet2);
  3511. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3512. }
  3513. static void mavlink_test_local_position_ned_system_global_offset(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  3514. {
  3515. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  3516. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  3517. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET >= 256) {
  3518. return;
  3519. }
  3520. #endif
  3521. mavlink_message_t msg;
  3522. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  3523. uint16_t i;
  3524. mavlink_local_position_ned_system_global_offset_t packet_in = {
  3525. 963497464,45.0,73.0,101.0,129.0,157.0,185.0
  3526. };
  3527. mavlink_local_position_ned_system_global_offset_t packet1, packet2;
  3528. memset(&packet1, 0, sizeof(packet1));
  3529. packet1.time_boot_ms = packet_in.time_boot_ms;
  3530. packet1.x = packet_in.x;
  3531. packet1.y = packet_in.y;
  3532. packet1.z = packet_in.z;
  3533. packet1.roll = packet_in.roll;
  3534. packet1.pitch = packet_in.pitch;
  3535. packet1.yaw = packet_in.yaw;
  3536. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  3537. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  3538. // cope with extensions
  3539. memset(MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET_MIN_LEN);
  3540. }
  3541. #endif
  3542. memset(&packet2, 0, sizeof(packet2));
  3543. mavlink_msg_local_position_ned_system_global_offset_encode(system_id, component_id, &msg, &packet1);
  3544. mavlink_msg_local_position_ned_system_global_offset_decode(&msg, &packet2);
  3545. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3546. memset(&packet2, 0, sizeof(packet2));
  3547. mavlink_msg_local_position_ned_system_global_offset_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw );
  3548. mavlink_msg_local_position_ned_system_global_offset_decode(&msg, &packet2);
  3549. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3550. memset(&packet2, 0, sizeof(packet2));
  3551. mavlink_msg_local_position_ned_system_global_offset_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw );
  3552. mavlink_msg_local_position_ned_system_global_offset_decode(&msg, &packet2);
  3553. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3554. memset(&packet2, 0, sizeof(packet2));
  3555. mavlink_msg_to_send_buffer(buffer, &msg);
  3556. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  3557. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  3558. }
  3559. mavlink_msg_local_position_ned_system_global_offset_decode(last_msg, &packet2);
  3560. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3561. memset(&packet2, 0, sizeof(packet2));
  3562. mavlink_msg_local_position_ned_system_global_offset_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw );
  3563. mavlink_msg_local_position_ned_system_global_offset_decode(last_msg, &packet2);
  3564. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3565. }
  3566. static void mavlink_test_hil_state(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  3567. {
  3568. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  3569. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  3570. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_HIL_STATE >= 256) {
  3571. return;
  3572. }
  3573. #endif
  3574. mavlink_message_t msg;
  3575. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  3576. uint16_t i;
  3577. mavlink_hil_state_t packet_in = {
  3578. 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0,963499128,963499336,963499544,19523,19627,19731,19835,19939,20043
  3579. };
  3580. mavlink_hil_state_t packet1, packet2;
  3581. memset(&packet1, 0, sizeof(packet1));
  3582. packet1.time_usec = packet_in.time_usec;
  3583. packet1.roll = packet_in.roll;
  3584. packet1.pitch = packet_in.pitch;
  3585. packet1.yaw = packet_in.yaw;
  3586. packet1.rollspeed = packet_in.rollspeed;
  3587. packet1.pitchspeed = packet_in.pitchspeed;
  3588. packet1.yawspeed = packet_in.yawspeed;
  3589. packet1.lat = packet_in.lat;
  3590. packet1.lon = packet_in.lon;
  3591. packet1.alt = packet_in.alt;
  3592. packet1.vx = packet_in.vx;
  3593. packet1.vy = packet_in.vy;
  3594. packet1.vz = packet_in.vz;
  3595. packet1.xacc = packet_in.xacc;
  3596. packet1.yacc = packet_in.yacc;
  3597. packet1.zacc = packet_in.zacc;
  3598. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  3599. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  3600. // cope with extensions
  3601. memset(MAVLINK_MSG_ID_HIL_STATE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_HIL_STATE_MIN_LEN);
  3602. }
  3603. #endif
  3604. memset(&packet2, 0, sizeof(packet2));
  3605. mavlink_msg_hil_state_encode(system_id, component_id, &msg, &packet1);
  3606. mavlink_msg_hil_state_decode(&msg, &packet2);
  3607. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3608. memset(&packet2, 0, sizeof(packet2));
  3609. mavlink_msg_hil_state_pack(system_id, component_id, &msg , packet1.time_usec , packet1.roll , packet1.pitch , packet1.yaw , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed , packet1.lat , packet1.lon , packet1.alt , packet1.vx , packet1.vy , packet1.vz , packet1.xacc , packet1.yacc , packet1.zacc );
  3610. mavlink_msg_hil_state_decode(&msg, &packet2);
  3611. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3612. memset(&packet2, 0, sizeof(packet2));
  3613. mavlink_msg_hil_state_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.roll , packet1.pitch , packet1.yaw , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed , packet1.lat , packet1.lon , packet1.alt , packet1.vx , packet1.vy , packet1.vz , packet1.xacc , packet1.yacc , packet1.zacc );
  3614. mavlink_msg_hil_state_decode(&msg, &packet2);
  3615. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3616. memset(&packet2, 0, sizeof(packet2));
  3617. mavlink_msg_to_send_buffer(buffer, &msg);
  3618. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  3619. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  3620. }
  3621. mavlink_msg_hil_state_decode(last_msg, &packet2);
  3622. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3623. memset(&packet2, 0, sizeof(packet2));
  3624. mavlink_msg_hil_state_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.roll , packet1.pitch , packet1.yaw , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed , packet1.lat , packet1.lon , packet1.alt , packet1.vx , packet1.vy , packet1.vz , packet1.xacc , packet1.yacc , packet1.zacc );
  3625. mavlink_msg_hil_state_decode(last_msg, &packet2);
  3626. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3627. }
  3628. static void mavlink_test_hil_controls(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  3629. {
  3630. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  3631. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  3632. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_HIL_CONTROLS >= 256) {
  3633. return;
  3634. }
  3635. #endif
  3636. mavlink_message_t msg;
  3637. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  3638. uint16_t i;
  3639. mavlink_hil_controls_t packet_in = {
  3640. 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0,241.0,269.0,125,192
  3641. };
  3642. mavlink_hil_controls_t packet1, packet2;
  3643. memset(&packet1, 0, sizeof(packet1));
  3644. packet1.time_usec = packet_in.time_usec;
  3645. packet1.roll_ailerons = packet_in.roll_ailerons;
  3646. packet1.pitch_elevator = packet_in.pitch_elevator;
  3647. packet1.yaw_rudder = packet_in.yaw_rudder;
  3648. packet1.throttle = packet_in.throttle;
  3649. packet1.aux1 = packet_in.aux1;
  3650. packet1.aux2 = packet_in.aux2;
  3651. packet1.aux3 = packet_in.aux3;
  3652. packet1.aux4 = packet_in.aux4;
  3653. packet1.mode = packet_in.mode;
  3654. packet1.nav_mode = packet_in.nav_mode;
  3655. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  3656. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  3657. // cope with extensions
  3658. memset(MAVLINK_MSG_ID_HIL_CONTROLS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_HIL_CONTROLS_MIN_LEN);
  3659. }
  3660. #endif
  3661. memset(&packet2, 0, sizeof(packet2));
  3662. mavlink_msg_hil_controls_encode(system_id, component_id, &msg, &packet1);
  3663. mavlink_msg_hil_controls_decode(&msg, &packet2);
  3664. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3665. memset(&packet2, 0, sizeof(packet2));
  3666. mavlink_msg_hil_controls_pack(system_id, component_id, &msg , packet1.time_usec , packet1.roll_ailerons , packet1.pitch_elevator , packet1.yaw_rudder , packet1.throttle , packet1.aux1 , packet1.aux2 , packet1.aux3 , packet1.aux4 , packet1.mode , packet1.nav_mode );
  3667. mavlink_msg_hil_controls_decode(&msg, &packet2);
  3668. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3669. memset(&packet2, 0, sizeof(packet2));
  3670. mavlink_msg_hil_controls_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.roll_ailerons , packet1.pitch_elevator , packet1.yaw_rudder , packet1.throttle , packet1.aux1 , packet1.aux2 , packet1.aux3 , packet1.aux4 , packet1.mode , packet1.nav_mode );
  3671. mavlink_msg_hil_controls_decode(&msg, &packet2);
  3672. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3673. memset(&packet2, 0, sizeof(packet2));
  3674. mavlink_msg_to_send_buffer(buffer, &msg);
  3675. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  3676. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  3677. }
  3678. mavlink_msg_hil_controls_decode(last_msg, &packet2);
  3679. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3680. memset(&packet2, 0, sizeof(packet2));
  3681. mavlink_msg_hil_controls_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.roll_ailerons , packet1.pitch_elevator , packet1.yaw_rudder , packet1.throttle , packet1.aux1 , packet1.aux2 , packet1.aux3 , packet1.aux4 , packet1.mode , packet1.nav_mode );
  3682. mavlink_msg_hil_controls_decode(last_msg, &packet2);
  3683. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3684. }
  3685. static void mavlink_test_hil_rc_inputs_raw(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  3686. {
  3687. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  3688. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  3689. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_HIL_RC_INPUTS_RAW >= 256) {
  3690. return;
  3691. }
  3692. #endif
  3693. mavlink_message_t msg;
  3694. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  3695. uint16_t i;
  3696. mavlink_hil_rc_inputs_raw_t packet_in = {
  3697. 93372036854775807ULL,17651,17755,17859,17963,18067,18171,18275,18379,18483,18587,18691,18795,101
  3698. };
  3699. mavlink_hil_rc_inputs_raw_t packet1, packet2;
  3700. memset(&packet1, 0, sizeof(packet1));
  3701. packet1.time_usec = packet_in.time_usec;
  3702. packet1.chan1_raw = packet_in.chan1_raw;
  3703. packet1.chan2_raw = packet_in.chan2_raw;
  3704. packet1.chan3_raw = packet_in.chan3_raw;
  3705. packet1.chan4_raw = packet_in.chan4_raw;
  3706. packet1.chan5_raw = packet_in.chan5_raw;
  3707. packet1.chan6_raw = packet_in.chan6_raw;
  3708. packet1.chan7_raw = packet_in.chan7_raw;
  3709. packet1.chan8_raw = packet_in.chan8_raw;
  3710. packet1.chan9_raw = packet_in.chan9_raw;
  3711. packet1.chan10_raw = packet_in.chan10_raw;
  3712. packet1.chan11_raw = packet_in.chan11_raw;
  3713. packet1.chan12_raw = packet_in.chan12_raw;
  3714. packet1.rssi = packet_in.rssi;
  3715. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  3716. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  3717. // cope with extensions
  3718. memset(MAVLINK_MSG_ID_HIL_RC_INPUTS_RAW_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_HIL_RC_INPUTS_RAW_MIN_LEN);
  3719. }
  3720. #endif
  3721. memset(&packet2, 0, sizeof(packet2));
  3722. mavlink_msg_hil_rc_inputs_raw_encode(system_id, component_id, &msg, &packet1);
  3723. mavlink_msg_hil_rc_inputs_raw_decode(&msg, &packet2);
  3724. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3725. memset(&packet2, 0, sizeof(packet2));
  3726. mavlink_msg_hil_rc_inputs_raw_pack(system_id, component_id, &msg , packet1.time_usec , packet1.chan1_raw , packet1.chan2_raw , packet1.chan3_raw , packet1.chan4_raw , packet1.chan5_raw , packet1.chan6_raw , packet1.chan7_raw , packet1.chan8_raw , packet1.chan9_raw , packet1.chan10_raw , packet1.chan11_raw , packet1.chan12_raw , packet1.rssi );
  3727. mavlink_msg_hil_rc_inputs_raw_decode(&msg, &packet2);
  3728. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3729. memset(&packet2, 0, sizeof(packet2));
  3730. mavlink_msg_hil_rc_inputs_raw_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.chan1_raw , packet1.chan2_raw , packet1.chan3_raw , packet1.chan4_raw , packet1.chan5_raw , packet1.chan6_raw , packet1.chan7_raw , packet1.chan8_raw , packet1.chan9_raw , packet1.chan10_raw , packet1.chan11_raw , packet1.chan12_raw , packet1.rssi );
  3731. mavlink_msg_hil_rc_inputs_raw_decode(&msg, &packet2);
  3732. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3733. memset(&packet2, 0, sizeof(packet2));
  3734. mavlink_msg_to_send_buffer(buffer, &msg);
  3735. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  3736. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  3737. }
  3738. mavlink_msg_hil_rc_inputs_raw_decode(last_msg, &packet2);
  3739. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3740. memset(&packet2, 0, sizeof(packet2));
  3741. mavlink_msg_hil_rc_inputs_raw_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.chan1_raw , packet1.chan2_raw , packet1.chan3_raw , packet1.chan4_raw , packet1.chan5_raw , packet1.chan6_raw , packet1.chan7_raw , packet1.chan8_raw , packet1.chan9_raw , packet1.chan10_raw , packet1.chan11_raw , packet1.chan12_raw , packet1.rssi );
  3742. mavlink_msg_hil_rc_inputs_raw_decode(last_msg, &packet2);
  3743. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3744. }
  3745. static void mavlink_test_hil_actuator_controls(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  3746. {
  3747. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  3748. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  3749. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS >= 256) {
  3750. return;
  3751. }
  3752. #endif
  3753. mavlink_message_t msg;
  3754. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  3755. uint16_t i;
  3756. mavlink_hil_actuator_controls_t packet_in = {
  3757. 93372036854775807ULL,93372036854776311ULL,{ 129.0, 130.0, 131.0, 132.0, 133.0, 134.0, 135.0, 136.0, 137.0, 138.0, 139.0, 140.0, 141.0, 142.0, 143.0, 144.0 },245
  3758. };
  3759. mavlink_hil_actuator_controls_t packet1, packet2;
  3760. memset(&packet1, 0, sizeof(packet1));
  3761. packet1.time_usec = packet_in.time_usec;
  3762. packet1.flags = packet_in.flags;
  3763. packet1.mode = packet_in.mode;
  3764. mav_array_memcpy(packet1.controls, packet_in.controls, sizeof(float)*16);
  3765. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  3766. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  3767. // cope with extensions
  3768. memset(MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS_MIN_LEN);
  3769. }
  3770. #endif
  3771. memset(&packet2, 0, sizeof(packet2));
  3772. mavlink_msg_hil_actuator_controls_encode(system_id, component_id, &msg, &packet1);
  3773. mavlink_msg_hil_actuator_controls_decode(&msg, &packet2);
  3774. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3775. memset(&packet2, 0, sizeof(packet2));
  3776. mavlink_msg_hil_actuator_controls_pack(system_id, component_id, &msg , packet1.time_usec , packet1.controls , packet1.mode , packet1.flags );
  3777. mavlink_msg_hil_actuator_controls_decode(&msg, &packet2);
  3778. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3779. memset(&packet2, 0, sizeof(packet2));
  3780. mavlink_msg_hil_actuator_controls_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.controls , packet1.mode , packet1.flags );
  3781. mavlink_msg_hil_actuator_controls_decode(&msg, &packet2);
  3782. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3783. memset(&packet2, 0, sizeof(packet2));
  3784. mavlink_msg_to_send_buffer(buffer, &msg);
  3785. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  3786. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  3787. }
  3788. mavlink_msg_hil_actuator_controls_decode(last_msg, &packet2);
  3789. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3790. memset(&packet2, 0, sizeof(packet2));
  3791. mavlink_msg_hil_actuator_controls_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.controls , packet1.mode , packet1.flags );
  3792. mavlink_msg_hil_actuator_controls_decode(last_msg, &packet2);
  3793. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3794. }
  3795. static void mavlink_test_optical_flow(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  3796. {
  3797. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  3798. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  3799. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_OPTICAL_FLOW >= 256) {
  3800. return;
  3801. }
  3802. #endif
  3803. mavlink_message_t msg;
  3804. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  3805. uint16_t i;
  3806. mavlink_optical_flow_t packet_in = {
  3807. 93372036854775807ULL,73.0,101.0,129.0,18275,18379,77,144,199.0,227.0
  3808. };
  3809. mavlink_optical_flow_t packet1, packet2;
  3810. memset(&packet1, 0, sizeof(packet1));
  3811. packet1.time_usec = packet_in.time_usec;
  3812. packet1.flow_comp_m_x = packet_in.flow_comp_m_x;
  3813. packet1.flow_comp_m_y = packet_in.flow_comp_m_y;
  3814. packet1.ground_distance = packet_in.ground_distance;
  3815. packet1.flow_x = packet_in.flow_x;
  3816. packet1.flow_y = packet_in.flow_y;
  3817. packet1.sensor_id = packet_in.sensor_id;
  3818. packet1.quality = packet_in.quality;
  3819. packet1.flow_rate_x = packet_in.flow_rate_x;
  3820. packet1.flow_rate_y = packet_in.flow_rate_y;
  3821. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  3822. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  3823. // cope with extensions
  3824. memset(MAVLINK_MSG_ID_OPTICAL_FLOW_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_OPTICAL_FLOW_MIN_LEN);
  3825. }
  3826. #endif
  3827. memset(&packet2, 0, sizeof(packet2));
  3828. mavlink_msg_optical_flow_encode(system_id, component_id, &msg, &packet1);
  3829. mavlink_msg_optical_flow_decode(&msg, &packet2);
  3830. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3831. memset(&packet2, 0, sizeof(packet2));
  3832. mavlink_msg_optical_flow_pack(system_id, component_id, &msg , packet1.time_usec , packet1.sensor_id , packet1.flow_x , packet1.flow_y , packet1.flow_comp_m_x , packet1.flow_comp_m_y , packet1.quality , packet1.ground_distance , packet1.flow_rate_x , packet1.flow_rate_y );
  3833. mavlink_msg_optical_flow_decode(&msg, &packet2);
  3834. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3835. memset(&packet2, 0, sizeof(packet2));
  3836. mavlink_msg_optical_flow_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.sensor_id , packet1.flow_x , packet1.flow_y , packet1.flow_comp_m_x , packet1.flow_comp_m_y , packet1.quality , packet1.ground_distance , packet1.flow_rate_x , packet1.flow_rate_y );
  3837. mavlink_msg_optical_flow_decode(&msg, &packet2);
  3838. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3839. memset(&packet2, 0, sizeof(packet2));
  3840. mavlink_msg_to_send_buffer(buffer, &msg);
  3841. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  3842. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  3843. }
  3844. mavlink_msg_optical_flow_decode(last_msg, &packet2);
  3845. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3846. memset(&packet2, 0, sizeof(packet2));
  3847. mavlink_msg_optical_flow_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.sensor_id , packet1.flow_x , packet1.flow_y , packet1.flow_comp_m_x , packet1.flow_comp_m_y , packet1.quality , packet1.ground_distance , packet1.flow_rate_x , packet1.flow_rate_y );
  3848. mavlink_msg_optical_flow_decode(last_msg, &packet2);
  3849. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3850. }
  3851. static void mavlink_test_global_vision_position_estimate(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  3852. {
  3853. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  3854. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  3855. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE >= 256) {
  3856. return;
  3857. }
  3858. #endif
  3859. mavlink_message_t msg;
  3860. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  3861. uint16_t i;
  3862. mavlink_global_vision_position_estimate_t packet_in = {
  3863. 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0,{ 241.0, 242.0, 243.0, 244.0, 245.0, 246.0, 247.0, 248.0, 249.0, 250.0, 251.0, 252.0, 253.0, 254.0, 255.0, 256.0, 257.0, 258.0, 259.0, 260.0, 261.0 },97
  3864. };
  3865. mavlink_global_vision_position_estimate_t packet1, packet2;
  3866. memset(&packet1, 0, sizeof(packet1));
  3867. packet1.usec = packet_in.usec;
  3868. packet1.x = packet_in.x;
  3869. packet1.y = packet_in.y;
  3870. packet1.z = packet_in.z;
  3871. packet1.roll = packet_in.roll;
  3872. packet1.pitch = packet_in.pitch;
  3873. packet1.yaw = packet_in.yaw;
  3874. packet1.reset_counter = packet_in.reset_counter;
  3875. mav_array_memcpy(packet1.covariance, packet_in.covariance, sizeof(float)*21);
  3876. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  3877. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  3878. // cope with extensions
  3879. memset(MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_MIN_LEN);
  3880. }
  3881. #endif
  3882. memset(&packet2, 0, sizeof(packet2));
  3883. mavlink_msg_global_vision_position_estimate_encode(system_id, component_id, &msg, &packet1);
  3884. mavlink_msg_global_vision_position_estimate_decode(&msg, &packet2);
  3885. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3886. memset(&packet2, 0, sizeof(packet2));
  3887. mavlink_msg_global_vision_position_estimate_pack(system_id, component_id, &msg , packet1.usec , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw , packet1.covariance , packet1.reset_counter );
  3888. mavlink_msg_global_vision_position_estimate_decode(&msg, &packet2);
  3889. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3890. memset(&packet2, 0, sizeof(packet2));
  3891. mavlink_msg_global_vision_position_estimate_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.usec , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw , packet1.covariance , packet1.reset_counter );
  3892. mavlink_msg_global_vision_position_estimate_decode(&msg, &packet2);
  3893. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3894. memset(&packet2, 0, sizeof(packet2));
  3895. mavlink_msg_to_send_buffer(buffer, &msg);
  3896. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  3897. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  3898. }
  3899. mavlink_msg_global_vision_position_estimate_decode(last_msg, &packet2);
  3900. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3901. memset(&packet2, 0, sizeof(packet2));
  3902. mavlink_msg_global_vision_position_estimate_send(MAVLINK_COMM_1 , packet1.usec , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw , packet1.covariance , packet1.reset_counter );
  3903. mavlink_msg_global_vision_position_estimate_decode(last_msg, &packet2);
  3904. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3905. }
  3906. static void mavlink_test_vision_position_estimate(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  3907. {
  3908. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  3909. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  3910. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE >= 256) {
  3911. return;
  3912. }
  3913. #endif
  3914. mavlink_message_t msg;
  3915. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  3916. uint16_t i;
  3917. mavlink_vision_position_estimate_t packet_in = {
  3918. 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0,{ 241.0, 242.0, 243.0, 244.0, 245.0, 246.0, 247.0, 248.0, 249.0, 250.0, 251.0, 252.0, 253.0, 254.0, 255.0, 256.0, 257.0, 258.0, 259.0, 260.0, 261.0 },97
  3919. };
  3920. mavlink_vision_position_estimate_t packet1, packet2;
  3921. memset(&packet1, 0, sizeof(packet1));
  3922. packet1.usec = packet_in.usec;
  3923. packet1.x = packet_in.x;
  3924. packet1.y = packet_in.y;
  3925. packet1.z = packet_in.z;
  3926. packet1.roll = packet_in.roll;
  3927. packet1.pitch = packet_in.pitch;
  3928. packet1.yaw = packet_in.yaw;
  3929. packet1.reset_counter = packet_in.reset_counter;
  3930. mav_array_memcpy(packet1.covariance, packet_in.covariance, sizeof(float)*21);
  3931. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  3932. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  3933. // cope with extensions
  3934. memset(MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_MIN_LEN);
  3935. }
  3936. #endif
  3937. memset(&packet2, 0, sizeof(packet2));
  3938. mavlink_msg_vision_position_estimate_encode(system_id, component_id, &msg, &packet1);
  3939. mavlink_msg_vision_position_estimate_decode(&msg, &packet2);
  3940. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3941. memset(&packet2, 0, sizeof(packet2));
  3942. mavlink_msg_vision_position_estimate_pack(system_id, component_id, &msg , packet1.usec , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw , packet1.covariance , packet1.reset_counter );
  3943. mavlink_msg_vision_position_estimate_decode(&msg, &packet2);
  3944. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3945. memset(&packet2, 0, sizeof(packet2));
  3946. mavlink_msg_vision_position_estimate_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.usec , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw , packet1.covariance , packet1.reset_counter );
  3947. mavlink_msg_vision_position_estimate_decode(&msg, &packet2);
  3948. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3949. memset(&packet2, 0, sizeof(packet2));
  3950. mavlink_msg_to_send_buffer(buffer, &msg);
  3951. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  3952. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  3953. }
  3954. mavlink_msg_vision_position_estimate_decode(last_msg, &packet2);
  3955. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3956. memset(&packet2, 0, sizeof(packet2));
  3957. mavlink_msg_vision_position_estimate_send(MAVLINK_COMM_1 , packet1.usec , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw , packet1.covariance , packet1.reset_counter );
  3958. mavlink_msg_vision_position_estimate_decode(last_msg, &packet2);
  3959. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3960. }
  3961. static void mavlink_test_vision_speed_estimate(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  3962. {
  3963. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  3964. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  3965. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE >= 256) {
  3966. return;
  3967. }
  3968. #endif
  3969. mavlink_message_t msg;
  3970. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  3971. uint16_t i;
  3972. mavlink_vision_speed_estimate_t packet_in = {
  3973. 93372036854775807ULL,73.0,101.0,129.0,{ 157.0, 158.0, 159.0, 160.0, 161.0, 162.0, 163.0, 164.0, 165.0 },173
  3974. };
  3975. mavlink_vision_speed_estimate_t packet1, packet2;
  3976. memset(&packet1, 0, sizeof(packet1));
  3977. packet1.usec = packet_in.usec;
  3978. packet1.x = packet_in.x;
  3979. packet1.y = packet_in.y;
  3980. packet1.z = packet_in.z;
  3981. packet1.reset_counter = packet_in.reset_counter;
  3982. mav_array_memcpy(packet1.covariance, packet_in.covariance, sizeof(float)*9);
  3983. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  3984. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  3985. // cope with extensions
  3986. memset(MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_MIN_LEN);
  3987. }
  3988. #endif
  3989. memset(&packet2, 0, sizeof(packet2));
  3990. mavlink_msg_vision_speed_estimate_encode(system_id, component_id, &msg, &packet1);
  3991. mavlink_msg_vision_speed_estimate_decode(&msg, &packet2);
  3992. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3993. memset(&packet2, 0, sizeof(packet2));
  3994. mavlink_msg_vision_speed_estimate_pack(system_id, component_id, &msg , packet1.usec , packet1.x , packet1.y , packet1.z , packet1.covariance , packet1.reset_counter );
  3995. mavlink_msg_vision_speed_estimate_decode(&msg, &packet2);
  3996. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  3997. memset(&packet2, 0, sizeof(packet2));
  3998. mavlink_msg_vision_speed_estimate_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.usec , packet1.x , packet1.y , packet1.z , packet1.covariance , packet1.reset_counter );
  3999. mavlink_msg_vision_speed_estimate_decode(&msg, &packet2);
  4000. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4001. memset(&packet2, 0, sizeof(packet2));
  4002. mavlink_msg_to_send_buffer(buffer, &msg);
  4003. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  4004. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  4005. }
  4006. mavlink_msg_vision_speed_estimate_decode(last_msg, &packet2);
  4007. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4008. memset(&packet2, 0, sizeof(packet2));
  4009. mavlink_msg_vision_speed_estimate_send(MAVLINK_COMM_1 , packet1.usec , packet1.x , packet1.y , packet1.z , packet1.covariance , packet1.reset_counter );
  4010. mavlink_msg_vision_speed_estimate_decode(last_msg, &packet2);
  4011. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4012. }
  4013. static void mavlink_test_vicon_position_estimate(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  4014. {
  4015. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  4016. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  4017. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE >= 256) {
  4018. return;
  4019. }
  4020. #endif
  4021. mavlink_message_t msg;
  4022. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  4023. uint16_t i;
  4024. mavlink_vicon_position_estimate_t packet_in = {
  4025. 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0,{ 241.0, 242.0, 243.0, 244.0, 245.0, 246.0, 247.0, 248.0, 249.0, 250.0, 251.0, 252.0, 253.0, 254.0, 255.0, 256.0, 257.0, 258.0, 259.0, 260.0, 261.0 }
  4026. };
  4027. mavlink_vicon_position_estimate_t packet1, packet2;
  4028. memset(&packet1, 0, sizeof(packet1));
  4029. packet1.usec = packet_in.usec;
  4030. packet1.x = packet_in.x;
  4031. packet1.y = packet_in.y;
  4032. packet1.z = packet_in.z;
  4033. packet1.roll = packet_in.roll;
  4034. packet1.pitch = packet_in.pitch;
  4035. packet1.yaw = packet_in.yaw;
  4036. mav_array_memcpy(packet1.covariance, packet_in.covariance, sizeof(float)*21);
  4037. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  4038. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  4039. // cope with extensions
  4040. memset(MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE_MIN_LEN);
  4041. }
  4042. #endif
  4043. memset(&packet2, 0, sizeof(packet2));
  4044. mavlink_msg_vicon_position_estimate_encode(system_id, component_id, &msg, &packet1);
  4045. mavlink_msg_vicon_position_estimate_decode(&msg, &packet2);
  4046. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4047. memset(&packet2, 0, sizeof(packet2));
  4048. mavlink_msg_vicon_position_estimate_pack(system_id, component_id, &msg , packet1.usec , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw , packet1.covariance );
  4049. mavlink_msg_vicon_position_estimate_decode(&msg, &packet2);
  4050. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4051. memset(&packet2, 0, sizeof(packet2));
  4052. mavlink_msg_vicon_position_estimate_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.usec , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw , packet1.covariance );
  4053. mavlink_msg_vicon_position_estimate_decode(&msg, &packet2);
  4054. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4055. memset(&packet2, 0, sizeof(packet2));
  4056. mavlink_msg_to_send_buffer(buffer, &msg);
  4057. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  4058. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  4059. }
  4060. mavlink_msg_vicon_position_estimate_decode(last_msg, &packet2);
  4061. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4062. memset(&packet2, 0, sizeof(packet2));
  4063. mavlink_msg_vicon_position_estimate_send(MAVLINK_COMM_1 , packet1.usec , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw , packet1.covariance );
  4064. mavlink_msg_vicon_position_estimate_decode(last_msg, &packet2);
  4065. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4066. }
  4067. static void mavlink_test_highres_imu(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  4068. {
  4069. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  4070. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  4071. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_HIGHRES_IMU >= 256) {
  4072. return;
  4073. }
  4074. #endif
  4075. mavlink_message_t msg;
  4076. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  4077. uint16_t i;
  4078. mavlink_highres_imu_t packet_in = {
  4079. 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,20355,63
  4080. };
  4081. mavlink_highres_imu_t packet1, packet2;
  4082. memset(&packet1, 0, sizeof(packet1));
  4083. packet1.time_usec = packet_in.time_usec;
  4084. packet1.xacc = packet_in.xacc;
  4085. packet1.yacc = packet_in.yacc;
  4086. packet1.zacc = packet_in.zacc;
  4087. packet1.xgyro = packet_in.xgyro;
  4088. packet1.ygyro = packet_in.ygyro;
  4089. packet1.zgyro = packet_in.zgyro;
  4090. packet1.xmag = packet_in.xmag;
  4091. packet1.ymag = packet_in.ymag;
  4092. packet1.zmag = packet_in.zmag;
  4093. packet1.abs_pressure = packet_in.abs_pressure;
  4094. packet1.diff_pressure = packet_in.diff_pressure;
  4095. packet1.pressure_alt = packet_in.pressure_alt;
  4096. packet1.temperature = packet_in.temperature;
  4097. packet1.fields_updated = packet_in.fields_updated;
  4098. packet1.id = packet_in.id;
  4099. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  4100. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  4101. // cope with extensions
  4102. memset(MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN);
  4103. }
  4104. #endif
  4105. memset(&packet2, 0, sizeof(packet2));
  4106. mavlink_msg_highres_imu_encode(system_id, component_id, &msg, &packet1);
  4107. mavlink_msg_highres_imu_decode(&msg, &packet2);
  4108. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4109. memset(&packet2, 0, sizeof(packet2));
  4110. mavlink_msg_highres_imu_pack(system_id, component_id, &msg , packet1.time_usec , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag , packet1.abs_pressure , packet1.diff_pressure , packet1.pressure_alt , packet1.temperature , packet1.fields_updated , packet1.id );
  4111. mavlink_msg_highres_imu_decode(&msg, &packet2);
  4112. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4113. memset(&packet2, 0, sizeof(packet2));
  4114. mavlink_msg_highres_imu_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag , packet1.abs_pressure , packet1.diff_pressure , packet1.pressure_alt , packet1.temperature , packet1.fields_updated , packet1.id );
  4115. mavlink_msg_highres_imu_decode(&msg, &packet2);
  4116. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4117. memset(&packet2, 0, sizeof(packet2));
  4118. mavlink_msg_to_send_buffer(buffer, &msg);
  4119. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  4120. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  4121. }
  4122. mavlink_msg_highres_imu_decode(last_msg, &packet2);
  4123. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4124. memset(&packet2, 0, sizeof(packet2));
  4125. mavlink_msg_highres_imu_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag , packet1.abs_pressure , packet1.diff_pressure , packet1.pressure_alt , packet1.temperature , packet1.fields_updated , packet1.id );
  4126. mavlink_msg_highres_imu_decode(last_msg, &packet2);
  4127. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4128. }
  4129. static void mavlink_test_optical_flow_rad(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  4130. {
  4131. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  4132. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  4133. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_OPTICAL_FLOW_RAD >= 256) {
  4134. return;
  4135. }
  4136. #endif
  4137. mavlink_message_t msg;
  4138. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  4139. uint16_t i;
  4140. mavlink_optical_flow_rad_t packet_in = {
  4141. 93372036854775807ULL,963497880,101.0,129.0,157.0,185.0,213.0,963499128,269.0,19315,3,70
  4142. };
  4143. mavlink_optical_flow_rad_t packet1, packet2;
  4144. memset(&packet1, 0, sizeof(packet1));
  4145. packet1.time_usec = packet_in.time_usec;
  4146. packet1.integration_time_us = packet_in.integration_time_us;
  4147. packet1.integrated_x = packet_in.integrated_x;
  4148. packet1.integrated_y = packet_in.integrated_y;
  4149. packet1.integrated_xgyro = packet_in.integrated_xgyro;
  4150. packet1.integrated_ygyro = packet_in.integrated_ygyro;
  4151. packet1.integrated_zgyro = packet_in.integrated_zgyro;
  4152. packet1.time_delta_distance_us = packet_in.time_delta_distance_us;
  4153. packet1.distance = packet_in.distance;
  4154. packet1.temperature = packet_in.temperature;
  4155. packet1.sensor_id = packet_in.sensor_id;
  4156. packet1.quality = packet_in.quality;
  4157. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  4158. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  4159. // cope with extensions
  4160. memset(MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_MIN_LEN);
  4161. }
  4162. #endif
  4163. memset(&packet2, 0, sizeof(packet2));
  4164. mavlink_msg_optical_flow_rad_encode(system_id, component_id, &msg, &packet1);
  4165. mavlink_msg_optical_flow_rad_decode(&msg, &packet2);
  4166. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4167. memset(&packet2, 0, sizeof(packet2));
  4168. mavlink_msg_optical_flow_rad_pack(system_id, component_id, &msg , packet1.time_usec , packet1.sensor_id , packet1.integration_time_us , packet1.integrated_x , packet1.integrated_y , packet1.integrated_xgyro , packet1.integrated_ygyro , packet1.integrated_zgyro , packet1.temperature , packet1.quality , packet1.time_delta_distance_us , packet1.distance );
  4169. mavlink_msg_optical_flow_rad_decode(&msg, &packet2);
  4170. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4171. memset(&packet2, 0, sizeof(packet2));
  4172. mavlink_msg_optical_flow_rad_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.sensor_id , packet1.integration_time_us , packet1.integrated_x , packet1.integrated_y , packet1.integrated_xgyro , packet1.integrated_ygyro , packet1.integrated_zgyro , packet1.temperature , packet1.quality , packet1.time_delta_distance_us , packet1.distance );
  4173. mavlink_msg_optical_flow_rad_decode(&msg, &packet2);
  4174. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4175. memset(&packet2, 0, sizeof(packet2));
  4176. mavlink_msg_to_send_buffer(buffer, &msg);
  4177. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  4178. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  4179. }
  4180. mavlink_msg_optical_flow_rad_decode(last_msg, &packet2);
  4181. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4182. memset(&packet2, 0, sizeof(packet2));
  4183. mavlink_msg_optical_flow_rad_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.sensor_id , packet1.integration_time_us , packet1.integrated_x , packet1.integrated_y , packet1.integrated_xgyro , packet1.integrated_ygyro , packet1.integrated_zgyro , packet1.temperature , packet1.quality , packet1.time_delta_distance_us , packet1.distance );
  4184. mavlink_msg_optical_flow_rad_decode(last_msg, &packet2);
  4185. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4186. }
  4187. static void mavlink_test_hil_sensor(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  4188. {
  4189. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  4190. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  4191. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_HIL_SENSOR >= 256) {
  4192. return;
  4193. }
  4194. #endif
  4195. mavlink_message_t msg;
  4196. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  4197. uint16_t i;
  4198. mavlink_hil_sensor_t packet_in = {
  4199. 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,963500584
  4200. };
  4201. mavlink_hil_sensor_t packet1, packet2;
  4202. memset(&packet1, 0, sizeof(packet1));
  4203. packet1.time_usec = packet_in.time_usec;
  4204. packet1.xacc = packet_in.xacc;
  4205. packet1.yacc = packet_in.yacc;
  4206. packet1.zacc = packet_in.zacc;
  4207. packet1.xgyro = packet_in.xgyro;
  4208. packet1.ygyro = packet_in.ygyro;
  4209. packet1.zgyro = packet_in.zgyro;
  4210. packet1.xmag = packet_in.xmag;
  4211. packet1.ymag = packet_in.ymag;
  4212. packet1.zmag = packet_in.zmag;
  4213. packet1.abs_pressure = packet_in.abs_pressure;
  4214. packet1.diff_pressure = packet_in.diff_pressure;
  4215. packet1.pressure_alt = packet_in.pressure_alt;
  4216. packet1.temperature = packet_in.temperature;
  4217. packet1.fields_updated = packet_in.fields_updated;
  4218. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  4219. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  4220. // cope with extensions
  4221. memset(MAVLINK_MSG_ID_HIL_SENSOR_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_HIL_SENSOR_MIN_LEN);
  4222. }
  4223. #endif
  4224. memset(&packet2, 0, sizeof(packet2));
  4225. mavlink_msg_hil_sensor_encode(system_id, component_id, &msg, &packet1);
  4226. mavlink_msg_hil_sensor_decode(&msg, &packet2);
  4227. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4228. memset(&packet2, 0, sizeof(packet2));
  4229. mavlink_msg_hil_sensor_pack(system_id, component_id, &msg , packet1.time_usec , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag , packet1.abs_pressure , packet1.diff_pressure , packet1.pressure_alt , packet1.temperature , packet1.fields_updated );
  4230. mavlink_msg_hil_sensor_decode(&msg, &packet2);
  4231. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4232. memset(&packet2, 0, sizeof(packet2));
  4233. mavlink_msg_hil_sensor_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag , packet1.abs_pressure , packet1.diff_pressure , packet1.pressure_alt , packet1.temperature , packet1.fields_updated );
  4234. mavlink_msg_hil_sensor_decode(&msg, &packet2);
  4235. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4236. memset(&packet2, 0, sizeof(packet2));
  4237. mavlink_msg_to_send_buffer(buffer, &msg);
  4238. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  4239. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  4240. }
  4241. mavlink_msg_hil_sensor_decode(last_msg, &packet2);
  4242. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4243. memset(&packet2, 0, sizeof(packet2));
  4244. mavlink_msg_hil_sensor_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag , packet1.abs_pressure , packet1.diff_pressure , packet1.pressure_alt , packet1.temperature , packet1.fields_updated );
  4245. mavlink_msg_hil_sensor_decode(last_msg, &packet2);
  4246. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4247. }
  4248. static void mavlink_test_sim_state(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  4249. {
  4250. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  4251. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  4252. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SIM_STATE >= 256) {
  4253. return;
  4254. }
  4255. #endif
  4256. mavlink_message_t msg;
  4257. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  4258. uint16_t i;
  4259. mavlink_sim_state_t packet_in = {
  4260. 17.0,45.0,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
  4261. };
  4262. mavlink_sim_state_t packet1, packet2;
  4263. memset(&packet1, 0, sizeof(packet1));
  4264. packet1.q1 = packet_in.q1;
  4265. packet1.q2 = packet_in.q2;
  4266. packet1.q3 = packet_in.q3;
  4267. packet1.q4 = packet_in.q4;
  4268. packet1.roll = packet_in.roll;
  4269. packet1.pitch = packet_in.pitch;
  4270. packet1.yaw = packet_in.yaw;
  4271. packet1.xacc = packet_in.xacc;
  4272. packet1.yacc = packet_in.yacc;
  4273. packet1.zacc = packet_in.zacc;
  4274. packet1.xgyro = packet_in.xgyro;
  4275. packet1.ygyro = packet_in.ygyro;
  4276. packet1.zgyro = packet_in.zgyro;
  4277. packet1.lat = packet_in.lat;
  4278. packet1.lon = packet_in.lon;
  4279. packet1.alt = packet_in.alt;
  4280. packet1.std_dev_horz = packet_in.std_dev_horz;
  4281. packet1.std_dev_vert = packet_in.std_dev_vert;
  4282. packet1.vn = packet_in.vn;
  4283. packet1.ve = packet_in.ve;
  4284. packet1.vd = packet_in.vd;
  4285. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  4286. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  4287. // cope with extensions
  4288. memset(MAVLINK_MSG_ID_SIM_STATE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SIM_STATE_MIN_LEN);
  4289. }
  4290. #endif
  4291. memset(&packet2, 0, sizeof(packet2));
  4292. mavlink_msg_sim_state_encode(system_id, component_id, &msg, &packet1);
  4293. mavlink_msg_sim_state_decode(&msg, &packet2);
  4294. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4295. memset(&packet2, 0, sizeof(packet2));
  4296. mavlink_msg_sim_state_pack(system_id, component_id, &msg , packet1.q1 , packet1.q2 , packet1.q3 , packet1.q4 , packet1.roll , packet1.pitch , packet1.yaw , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.lat , packet1.lon , packet1.alt , packet1.std_dev_horz , packet1.std_dev_vert , packet1.vn , packet1.ve , packet1.vd );
  4297. mavlink_msg_sim_state_decode(&msg, &packet2);
  4298. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4299. memset(&packet2, 0, sizeof(packet2));
  4300. mavlink_msg_sim_state_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.q1 , packet1.q2 , packet1.q3 , packet1.q4 , packet1.roll , packet1.pitch , packet1.yaw , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.lat , packet1.lon , packet1.alt , packet1.std_dev_horz , packet1.std_dev_vert , packet1.vn , packet1.ve , packet1.vd );
  4301. mavlink_msg_sim_state_decode(&msg, &packet2);
  4302. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4303. memset(&packet2, 0, sizeof(packet2));
  4304. mavlink_msg_to_send_buffer(buffer, &msg);
  4305. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  4306. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  4307. }
  4308. mavlink_msg_sim_state_decode(last_msg, &packet2);
  4309. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4310. memset(&packet2, 0, sizeof(packet2));
  4311. mavlink_msg_sim_state_send(MAVLINK_COMM_1 , packet1.q1 , packet1.q2 , packet1.q3 , packet1.q4 , packet1.roll , packet1.pitch , packet1.yaw , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.lat , packet1.lon , packet1.alt , packet1.std_dev_horz , packet1.std_dev_vert , packet1.vn , packet1.ve , packet1.vd );
  4312. mavlink_msg_sim_state_decode(last_msg, &packet2);
  4313. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4314. }
  4315. static void mavlink_test_radio_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  4316. {
  4317. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  4318. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  4319. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_RADIO_STATUS >= 256) {
  4320. return;
  4321. }
  4322. #endif
  4323. mavlink_message_t msg;
  4324. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  4325. uint16_t i;
  4326. mavlink_radio_status_t packet_in = {
  4327. 17235,17339,17,84,151,218,29
  4328. };
  4329. mavlink_radio_status_t packet1, packet2;
  4330. memset(&packet1, 0, sizeof(packet1));
  4331. packet1.rxerrors = packet_in.rxerrors;
  4332. packet1.fixed = packet_in.fixed;
  4333. packet1.rssi = packet_in.rssi;
  4334. packet1.remrssi = packet_in.remrssi;
  4335. packet1.txbuf = packet_in.txbuf;
  4336. packet1.noise = packet_in.noise;
  4337. packet1.remnoise = packet_in.remnoise;
  4338. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  4339. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  4340. // cope with extensions
  4341. memset(MAVLINK_MSG_ID_RADIO_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_RADIO_STATUS_MIN_LEN);
  4342. }
  4343. #endif
  4344. memset(&packet2, 0, sizeof(packet2));
  4345. mavlink_msg_radio_status_encode(system_id, component_id, &msg, &packet1);
  4346. mavlink_msg_radio_status_decode(&msg, &packet2);
  4347. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4348. memset(&packet2, 0, sizeof(packet2));
  4349. mavlink_msg_radio_status_pack(system_id, component_id, &msg , packet1.rssi , packet1.remrssi , packet1.txbuf , packet1.noise , packet1.remnoise , packet1.rxerrors , packet1.fixed );
  4350. mavlink_msg_radio_status_decode(&msg, &packet2);
  4351. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4352. memset(&packet2, 0, sizeof(packet2));
  4353. mavlink_msg_radio_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.rssi , packet1.remrssi , packet1.txbuf , packet1.noise , packet1.remnoise , packet1.rxerrors , packet1.fixed );
  4354. mavlink_msg_radio_status_decode(&msg, &packet2);
  4355. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4356. memset(&packet2, 0, sizeof(packet2));
  4357. mavlink_msg_to_send_buffer(buffer, &msg);
  4358. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  4359. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  4360. }
  4361. mavlink_msg_radio_status_decode(last_msg, &packet2);
  4362. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4363. memset(&packet2, 0, sizeof(packet2));
  4364. mavlink_msg_radio_status_send(MAVLINK_COMM_1 , packet1.rssi , packet1.remrssi , packet1.txbuf , packet1.noise , packet1.remnoise , packet1.rxerrors , packet1.fixed );
  4365. mavlink_msg_radio_status_decode(last_msg, &packet2);
  4366. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4367. }
  4368. static void mavlink_test_file_transfer_protocol(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  4369. {
  4370. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  4371. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  4372. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL >= 256) {
  4373. return;
  4374. }
  4375. #endif
  4376. mavlink_message_t msg;
  4377. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  4378. uint16_t i;
  4379. mavlink_file_transfer_protocol_t packet_in = {
  4380. 5,72,139,{ 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200 }
  4381. };
  4382. mavlink_file_transfer_protocol_t packet1, packet2;
  4383. memset(&packet1, 0, sizeof(packet1));
  4384. packet1.target_network = packet_in.target_network;
  4385. packet1.target_system = packet_in.target_system;
  4386. packet1.target_component = packet_in.target_component;
  4387. mav_array_memcpy(packet1.payload, packet_in.payload, sizeof(uint8_t)*251);
  4388. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  4389. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  4390. // cope with extensions
  4391. memset(MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_MIN_LEN);
  4392. }
  4393. #endif
  4394. memset(&packet2, 0, sizeof(packet2));
  4395. mavlink_msg_file_transfer_protocol_encode(system_id, component_id, &msg, &packet1);
  4396. mavlink_msg_file_transfer_protocol_decode(&msg, &packet2);
  4397. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4398. memset(&packet2, 0, sizeof(packet2));
  4399. mavlink_msg_file_transfer_protocol_pack(system_id, component_id, &msg , packet1.target_network , packet1.target_system , packet1.target_component , packet1.payload );
  4400. mavlink_msg_file_transfer_protocol_decode(&msg, &packet2);
  4401. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4402. memset(&packet2, 0, sizeof(packet2));
  4403. mavlink_msg_file_transfer_protocol_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_network , packet1.target_system , packet1.target_component , packet1.payload );
  4404. mavlink_msg_file_transfer_protocol_decode(&msg, &packet2);
  4405. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4406. memset(&packet2, 0, sizeof(packet2));
  4407. mavlink_msg_to_send_buffer(buffer, &msg);
  4408. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  4409. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  4410. }
  4411. mavlink_msg_file_transfer_protocol_decode(last_msg, &packet2);
  4412. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4413. memset(&packet2, 0, sizeof(packet2));
  4414. mavlink_msg_file_transfer_protocol_send(MAVLINK_COMM_1 , packet1.target_network , packet1.target_system , packet1.target_component , packet1.payload );
  4415. mavlink_msg_file_transfer_protocol_decode(last_msg, &packet2);
  4416. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4417. }
  4418. static void mavlink_test_timesync(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  4419. {
  4420. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  4421. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  4422. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_TIMESYNC >= 256) {
  4423. return;
  4424. }
  4425. #endif
  4426. mavlink_message_t msg;
  4427. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  4428. uint16_t i;
  4429. mavlink_timesync_t packet_in = {
  4430. 93372036854775807LL,93372036854776311LL
  4431. };
  4432. mavlink_timesync_t packet1, packet2;
  4433. memset(&packet1, 0, sizeof(packet1));
  4434. packet1.tc1 = packet_in.tc1;
  4435. packet1.ts1 = packet_in.ts1;
  4436. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  4437. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  4438. // cope with extensions
  4439. memset(MAVLINK_MSG_ID_TIMESYNC_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_TIMESYNC_MIN_LEN);
  4440. }
  4441. #endif
  4442. memset(&packet2, 0, sizeof(packet2));
  4443. mavlink_msg_timesync_encode(system_id, component_id, &msg, &packet1);
  4444. mavlink_msg_timesync_decode(&msg, &packet2);
  4445. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4446. memset(&packet2, 0, sizeof(packet2));
  4447. mavlink_msg_timesync_pack(system_id, component_id, &msg , packet1.tc1 , packet1.ts1 );
  4448. mavlink_msg_timesync_decode(&msg, &packet2);
  4449. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4450. memset(&packet2, 0, sizeof(packet2));
  4451. mavlink_msg_timesync_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.tc1 , packet1.ts1 );
  4452. mavlink_msg_timesync_decode(&msg, &packet2);
  4453. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4454. memset(&packet2, 0, sizeof(packet2));
  4455. mavlink_msg_to_send_buffer(buffer, &msg);
  4456. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  4457. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  4458. }
  4459. mavlink_msg_timesync_decode(last_msg, &packet2);
  4460. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4461. memset(&packet2, 0, sizeof(packet2));
  4462. mavlink_msg_timesync_send(MAVLINK_COMM_1 , packet1.tc1 , packet1.ts1 );
  4463. mavlink_msg_timesync_decode(last_msg, &packet2);
  4464. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4465. }
  4466. static void mavlink_test_camera_trigger(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  4467. {
  4468. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  4469. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  4470. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_CAMERA_TRIGGER >= 256) {
  4471. return;
  4472. }
  4473. #endif
  4474. mavlink_message_t msg;
  4475. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  4476. uint16_t i;
  4477. mavlink_camera_trigger_t packet_in = {
  4478. 93372036854775807ULL,963497880
  4479. };
  4480. mavlink_camera_trigger_t packet1, packet2;
  4481. memset(&packet1, 0, sizeof(packet1));
  4482. packet1.time_usec = packet_in.time_usec;
  4483. packet1.seq = packet_in.seq;
  4484. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  4485. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  4486. // cope with extensions
  4487. memset(MAVLINK_MSG_ID_CAMERA_TRIGGER_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_CAMERA_TRIGGER_MIN_LEN);
  4488. }
  4489. #endif
  4490. memset(&packet2, 0, sizeof(packet2));
  4491. mavlink_msg_camera_trigger_encode(system_id, component_id, &msg, &packet1);
  4492. mavlink_msg_camera_trigger_decode(&msg, &packet2);
  4493. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4494. memset(&packet2, 0, sizeof(packet2));
  4495. mavlink_msg_camera_trigger_pack(system_id, component_id, &msg , packet1.time_usec , packet1.seq );
  4496. mavlink_msg_camera_trigger_decode(&msg, &packet2);
  4497. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4498. memset(&packet2, 0, sizeof(packet2));
  4499. mavlink_msg_camera_trigger_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.seq );
  4500. mavlink_msg_camera_trigger_decode(&msg, &packet2);
  4501. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4502. memset(&packet2, 0, sizeof(packet2));
  4503. mavlink_msg_to_send_buffer(buffer, &msg);
  4504. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  4505. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  4506. }
  4507. mavlink_msg_camera_trigger_decode(last_msg, &packet2);
  4508. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4509. memset(&packet2, 0, sizeof(packet2));
  4510. mavlink_msg_camera_trigger_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.seq );
  4511. mavlink_msg_camera_trigger_decode(last_msg, &packet2);
  4512. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4513. }
  4514. static void mavlink_test_hil_gps(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  4515. {
  4516. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  4517. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  4518. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_HIL_GPS >= 256) {
  4519. return;
  4520. }
  4521. #endif
  4522. mavlink_message_t msg;
  4523. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  4524. uint16_t i;
  4525. mavlink_hil_gps_t packet_in = {
  4526. 93372036854775807ULL,963497880,963498088,963498296,18275,18379,18483,18587,18691,18795,18899,235,46
  4527. };
  4528. mavlink_hil_gps_t packet1, packet2;
  4529. memset(&packet1, 0, sizeof(packet1));
  4530. packet1.time_usec = packet_in.time_usec;
  4531. packet1.lat = packet_in.lat;
  4532. packet1.lon = packet_in.lon;
  4533. packet1.alt = packet_in.alt;
  4534. packet1.eph = packet_in.eph;
  4535. packet1.epv = packet_in.epv;
  4536. packet1.vel = packet_in.vel;
  4537. packet1.vn = packet_in.vn;
  4538. packet1.ve = packet_in.ve;
  4539. packet1.vd = packet_in.vd;
  4540. packet1.cog = packet_in.cog;
  4541. packet1.fix_type = packet_in.fix_type;
  4542. packet1.satellites_visible = packet_in.satellites_visible;
  4543. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  4544. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  4545. // cope with extensions
  4546. memset(MAVLINK_MSG_ID_HIL_GPS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_HIL_GPS_MIN_LEN);
  4547. }
  4548. #endif
  4549. memset(&packet2, 0, sizeof(packet2));
  4550. mavlink_msg_hil_gps_encode(system_id, component_id, &msg, &packet1);
  4551. mavlink_msg_hil_gps_decode(&msg, &packet2);
  4552. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4553. memset(&packet2, 0, sizeof(packet2));
  4554. mavlink_msg_hil_gps_pack(system_id, component_id, &msg , packet1.time_usec , packet1.fix_type , packet1.lat , packet1.lon , packet1.alt , packet1.eph , packet1.epv , packet1.vel , packet1.vn , packet1.ve , packet1.vd , packet1.cog , packet1.satellites_visible );
  4555. mavlink_msg_hil_gps_decode(&msg, &packet2);
  4556. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4557. memset(&packet2, 0, sizeof(packet2));
  4558. mavlink_msg_hil_gps_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.fix_type , packet1.lat , packet1.lon , packet1.alt , packet1.eph , packet1.epv , packet1.vel , packet1.vn , packet1.ve , packet1.vd , packet1.cog , packet1.satellites_visible );
  4559. mavlink_msg_hil_gps_decode(&msg, &packet2);
  4560. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4561. memset(&packet2, 0, sizeof(packet2));
  4562. mavlink_msg_to_send_buffer(buffer, &msg);
  4563. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  4564. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  4565. }
  4566. mavlink_msg_hil_gps_decode(last_msg, &packet2);
  4567. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4568. memset(&packet2, 0, sizeof(packet2));
  4569. mavlink_msg_hil_gps_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.fix_type , packet1.lat , packet1.lon , packet1.alt , packet1.eph , packet1.epv , packet1.vel , packet1.vn , packet1.ve , packet1.vd , packet1.cog , packet1.satellites_visible );
  4570. mavlink_msg_hil_gps_decode(last_msg, &packet2);
  4571. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4572. }
  4573. static void mavlink_test_hil_optical_flow(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  4574. {
  4575. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  4576. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  4577. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_HIL_OPTICAL_FLOW >= 256) {
  4578. return;
  4579. }
  4580. #endif
  4581. mavlink_message_t msg;
  4582. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  4583. uint16_t i;
  4584. mavlink_hil_optical_flow_t packet_in = {
  4585. 93372036854775807ULL,963497880,101.0,129.0,157.0,185.0,213.0,963499128,269.0,19315,3,70
  4586. };
  4587. mavlink_hil_optical_flow_t packet1, packet2;
  4588. memset(&packet1, 0, sizeof(packet1));
  4589. packet1.time_usec = packet_in.time_usec;
  4590. packet1.integration_time_us = packet_in.integration_time_us;
  4591. packet1.integrated_x = packet_in.integrated_x;
  4592. packet1.integrated_y = packet_in.integrated_y;
  4593. packet1.integrated_xgyro = packet_in.integrated_xgyro;
  4594. packet1.integrated_ygyro = packet_in.integrated_ygyro;
  4595. packet1.integrated_zgyro = packet_in.integrated_zgyro;
  4596. packet1.time_delta_distance_us = packet_in.time_delta_distance_us;
  4597. packet1.distance = packet_in.distance;
  4598. packet1.temperature = packet_in.temperature;
  4599. packet1.sensor_id = packet_in.sensor_id;
  4600. packet1.quality = packet_in.quality;
  4601. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  4602. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  4603. // cope with extensions
  4604. memset(MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_MIN_LEN);
  4605. }
  4606. #endif
  4607. memset(&packet2, 0, sizeof(packet2));
  4608. mavlink_msg_hil_optical_flow_encode(system_id, component_id, &msg, &packet1);
  4609. mavlink_msg_hil_optical_flow_decode(&msg, &packet2);
  4610. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4611. memset(&packet2, 0, sizeof(packet2));
  4612. mavlink_msg_hil_optical_flow_pack(system_id, component_id, &msg , packet1.time_usec , packet1.sensor_id , packet1.integration_time_us , packet1.integrated_x , packet1.integrated_y , packet1.integrated_xgyro , packet1.integrated_ygyro , packet1.integrated_zgyro , packet1.temperature , packet1.quality , packet1.time_delta_distance_us , packet1.distance );
  4613. mavlink_msg_hil_optical_flow_decode(&msg, &packet2);
  4614. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4615. memset(&packet2, 0, sizeof(packet2));
  4616. mavlink_msg_hil_optical_flow_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.sensor_id , packet1.integration_time_us , packet1.integrated_x , packet1.integrated_y , packet1.integrated_xgyro , packet1.integrated_ygyro , packet1.integrated_zgyro , packet1.temperature , packet1.quality , packet1.time_delta_distance_us , packet1.distance );
  4617. mavlink_msg_hil_optical_flow_decode(&msg, &packet2);
  4618. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4619. memset(&packet2, 0, sizeof(packet2));
  4620. mavlink_msg_to_send_buffer(buffer, &msg);
  4621. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  4622. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  4623. }
  4624. mavlink_msg_hil_optical_flow_decode(last_msg, &packet2);
  4625. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4626. memset(&packet2, 0, sizeof(packet2));
  4627. mavlink_msg_hil_optical_flow_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.sensor_id , packet1.integration_time_us , packet1.integrated_x , packet1.integrated_y , packet1.integrated_xgyro , packet1.integrated_ygyro , packet1.integrated_zgyro , packet1.temperature , packet1.quality , packet1.time_delta_distance_us , packet1.distance );
  4628. mavlink_msg_hil_optical_flow_decode(last_msg, &packet2);
  4629. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4630. }
  4631. static void mavlink_test_hil_state_quaternion(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  4632. {
  4633. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  4634. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  4635. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_HIL_STATE_QUATERNION >= 256) {
  4636. return;
  4637. }
  4638. #endif
  4639. mavlink_message_t msg;
  4640. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  4641. uint16_t i;
  4642. mavlink_hil_state_quaternion_t packet_in = {
  4643. 93372036854775807ULL,{ 73.0, 74.0, 75.0, 76.0 },185.0,213.0,241.0,963499336,963499544,963499752,19731,19835,19939,20043,20147,20251,20355,20459
  4644. };
  4645. mavlink_hil_state_quaternion_t packet1, packet2;
  4646. memset(&packet1, 0, sizeof(packet1));
  4647. packet1.time_usec = packet_in.time_usec;
  4648. packet1.rollspeed = packet_in.rollspeed;
  4649. packet1.pitchspeed = packet_in.pitchspeed;
  4650. packet1.yawspeed = packet_in.yawspeed;
  4651. packet1.lat = packet_in.lat;
  4652. packet1.lon = packet_in.lon;
  4653. packet1.alt = packet_in.alt;
  4654. packet1.vx = packet_in.vx;
  4655. packet1.vy = packet_in.vy;
  4656. packet1.vz = packet_in.vz;
  4657. packet1.ind_airspeed = packet_in.ind_airspeed;
  4658. packet1.true_airspeed = packet_in.true_airspeed;
  4659. packet1.xacc = packet_in.xacc;
  4660. packet1.yacc = packet_in.yacc;
  4661. packet1.zacc = packet_in.zacc;
  4662. mav_array_memcpy(packet1.attitude_quaternion, packet_in.attitude_quaternion, sizeof(float)*4);
  4663. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  4664. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  4665. // cope with extensions
  4666. memset(MAVLINK_MSG_ID_HIL_STATE_QUATERNION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_HIL_STATE_QUATERNION_MIN_LEN);
  4667. }
  4668. #endif
  4669. memset(&packet2, 0, sizeof(packet2));
  4670. mavlink_msg_hil_state_quaternion_encode(system_id, component_id, &msg, &packet1);
  4671. mavlink_msg_hil_state_quaternion_decode(&msg, &packet2);
  4672. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4673. memset(&packet2, 0, sizeof(packet2));
  4674. mavlink_msg_hil_state_quaternion_pack(system_id, component_id, &msg , packet1.time_usec , packet1.attitude_quaternion , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed , packet1.lat , packet1.lon , packet1.alt , packet1.vx , packet1.vy , packet1.vz , packet1.ind_airspeed , packet1.true_airspeed , packet1.xacc , packet1.yacc , packet1.zacc );
  4675. mavlink_msg_hil_state_quaternion_decode(&msg, &packet2);
  4676. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4677. memset(&packet2, 0, sizeof(packet2));
  4678. mavlink_msg_hil_state_quaternion_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.attitude_quaternion , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed , packet1.lat , packet1.lon , packet1.alt , packet1.vx , packet1.vy , packet1.vz , packet1.ind_airspeed , packet1.true_airspeed , packet1.xacc , packet1.yacc , packet1.zacc );
  4679. mavlink_msg_hil_state_quaternion_decode(&msg, &packet2);
  4680. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4681. memset(&packet2, 0, sizeof(packet2));
  4682. mavlink_msg_to_send_buffer(buffer, &msg);
  4683. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  4684. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  4685. }
  4686. mavlink_msg_hil_state_quaternion_decode(last_msg, &packet2);
  4687. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4688. memset(&packet2, 0, sizeof(packet2));
  4689. mavlink_msg_hil_state_quaternion_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.attitude_quaternion , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed , packet1.lat , packet1.lon , packet1.alt , packet1.vx , packet1.vy , packet1.vz , packet1.ind_airspeed , packet1.true_airspeed , packet1.xacc , packet1.yacc , packet1.zacc );
  4690. mavlink_msg_hil_state_quaternion_decode(last_msg, &packet2);
  4691. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4692. }
  4693. static void mavlink_test_scaled_imu2(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  4694. {
  4695. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  4696. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  4697. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SCALED_IMU2 >= 256) {
  4698. return;
  4699. }
  4700. #endif
  4701. mavlink_message_t msg;
  4702. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  4703. uint16_t i;
  4704. mavlink_scaled_imu2_t packet_in = {
  4705. 963497464,17443,17547,17651,17755,17859,17963,18067,18171,18275,18379
  4706. };
  4707. mavlink_scaled_imu2_t packet1, packet2;
  4708. memset(&packet1, 0, sizeof(packet1));
  4709. packet1.time_boot_ms = packet_in.time_boot_ms;
  4710. packet1.xacc = packet_in.xacc;
  4711. packet1.yacc = packet_in.yacc;
  4712. packet1.zacc = packet_in.zacc;
  4713. packet1.xgyro = packet_in.xgyro;
  4714. packet1.ygyro = packet_in.ygyro;
  4715. packet1.zgyro = packet_in.zgyro;
  4716. packet1.xmag = packet_in.xmag;
  4717. packet1.ymag = packet_in.ymag;
  4718. packet1.zmag = packet_in.zmag;
  4719. packet1.temperature = packet_in.temperature;
  4720. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  4721. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  4722. // cope with extensions
  4723. memset(MAVLINK_MSG_ID_SCALED_IMU2_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SCALED_IMU2_MIN_LEN);
  4724. }
  4725. #endif
  4726. memset(&packet2, 0, sizeof(packet2));
  4727. mavlink_msg_scaled_imu2_encode(system_id, component_id, &msg, &packet1);
  4728. mavlink_msg_scaled_imu2_decode(&msg, &packet2);
  4729. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4730. memset(&packet2, 0, sizeof(packet2));
  4731. mavlink_msg_scaled_imu2_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag , packet1.temperature );
  4732. mavlink_msg_scaled_imu2_decode(&msg, &packet2);
  4733. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4734. memset(&packet2, 0, sizeof(packet2));
  4735. mavlink_msg_scaled_imu2_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag , packet1.temperature );
  4736. mavlink_msg_scaled_imu2_decode(&msg, &packet2);
  4737. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4738. memset(&packet2, 0, sizeof(packet2));
  4739. mavlink_msg_to_send_buffer(buffer, &msg);
  4740. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  4741. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  4742. }
  4743. mavlink_msg_scaled_imu2_decode(last_msg, &packet2);
  4744. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4745. memset(&packet2, 0, sizeof(packet2));
  4746. mavlink_msg_scaled_imu2_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag , packet1.temperature );
  4747. mavlink_msg_scaled_imu2_decode(last_msg, &packet2);
  4748. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4749. }
  4750. static void mavlink_test_log_request_list(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  4751. {
  4752. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  4753. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  4754. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_LOG_REQUEST_LIST >= 256) {
  4755. return;
  4756. }
  4757. #endif
  4758. mavlink_message_t msg;
  4759. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  4760. uint16_t i;
  4761. mavlink_log_request_list_t packet_in = {
  4762. 17235,17339,17,84
  4763. };
  4764. mavlink_log_request_list_t packet1, packet2;
  4765. memset(&packet1, 0, sizeof(packet1));
  4766. packet1.start = packet_in.start;
  4767. packet1.end = packet_in.end;
  4768. packet1.target_system = packet_in.target_system;
  4769. packet1.target_component = packet_in.target_component;
  4770. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  4771. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  4772. // cope with extensions
  4773. memset(MAVLINK_MSG_ID_LOG_REQUEST_LIST_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_LOG_REQUEST_LIST_MIN_LEN);
  4774. }
  4775. #endif
  4776. memset(&packet2, 0, sizeof(packet2));
  4777. mavlink_msg_log_request_list_encode(system_id, component_id, &msg, &packet1);
  4778. mavlink_msg_log_request_list_decode(&msg, &packet2);
  4779. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4780. memset(&packet2, 0, sizeof(packet2));
  4781. mavlink_msg_log_request_list_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.start , packet1.end );
  4782. mavlink_msg_log_request_list_decode(&msg, &packet2);
  4783. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4784. memset(&packet2, 0, sizeof(packet2));
  4785. mavlink_msg_log_request_list_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.start , packet1.end );
  4786. mavlink_msg_log_request_list_decode(&msg, &packet2);
  4787. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4788. memset(&packet2, 0, sizeof(packet2));
  4789. mavlink_msg_to_send_buffer(buffer, &msg);
  4790. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  4791. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  4792. }
  4793. mavlink_msg_log_request_list_decode(last_msg, &packet2);
  4794. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4795. memset(&packet2, 0, sizeof(packet2));
  4796. mavlink_msg_log_request_list_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.start , packet1.end );
  4797. mavlink_msg_log_request_list_decode(last_msg, &packet2);
  4798. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4799. }
  4800. static void mavlink_test_log_entry(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  4801. {
  4802. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  4803. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  4804. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_LOG_ENTRY >= 256) {
  4805. return;
  4806. }
  4807. #endif
  4808. mavlink_message_t msg;
  4809. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  4810. uint16_t i;
  4811. mavlink_log_entry_t packet_in = {
  4812. 963497464,963497672,17651,17755,17859
  4813. };
  4814. mavlink_log_entry_t packet1, packet2;
  4815. memset(&packet1, 0, sizeof(packet1));
  4816. packet1.time_utc = packet_in.time_utc;
  4817. packet1.size = packet_in.size;
  4818. packet1.id = packet_in.id;
  4819. packet1.num_logs = packet_in.num_logs;
  4820. packet1.last_log_num = packet_in.last_log_num;
  4821. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  4822. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  4823. // cope with extensions
  4824. memset(MAVLINK_MSG_ID_LOG_ENTRY_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_LOG_ENTRY_MIN_LEN);
  4825. }
  4826. #endif
  4827. memset(&packet2, 0, sizeof(packet2));
  4828. mavlink_msg_log_entry_encode(system_id, component_id, &msg, &packet1);
  4829. mavlink_msg_log_entry_decode(&msg, &packet2);
  4830. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4831. memset(&packet2, 0, sizeof(packet2));
  4832. mavlink_msg_log_entry_pack(system_id, component_id, &msg , packet1.id , packet1.num_logs , packet1.last_log_num , packet1.time_utc , packet1.size );
  4833. mavlink_msg_log_entry_decode(&msg, &packet2);
  4834. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4835. memset(&packet2, 0, sizeof(packet2));
  4836. mavlink_msg_log_entry_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.id , packet1.num_logs , packet1.last_log_num , packet1.time_utc , packet1.size );
  4837. mavlink_msg_log_entry_decode(&msg, &packet2);
  4838. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4839. memset(&packet2, 0, sizeof(packet2));
  4840. mavlink_msg_to_send_buffer(buffer, &msg);
  4841. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  4842. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  4843. }
  4844. mavlink_msg_log_entry_decode(last_msg, &packet2);
  4845. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4846. memset(&packet2, 0, sizeof(packet2));
  4847. mavlink_msg_log_entry_send(MAVLINK_COMM_1 , packet1.id , packet1.num_logs , packet1.last_log_num , packet1.time_utc , packet1.size );
  4848. mavlink_msg_log_entry_decode(last_msg, &packet2);
  4849. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4850. }
  4851. static void mavlink_test_log_request_data(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  4852. {
  4853. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  4854. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  4855. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_LOG_REQUEST_DATA >= 256) {
  4856. return;
  4857. }
  4858. #endif
  4859. mavlink_message_t msg;
  4860. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  4861. uint16_t i;
  4862. mavlink_log_request_data_t packet_in = {
  4863. 963497464,963497672,17651,163,230
  4864. };
  4865. mavlink_log_request_data_t packet1, packet2;
  4866. memset(&packet1, 0, sizeof(packet1));
  4867. packet1.ofs = packet_in.ofs;
  4868. packet1.count = packet_in.count;
  4869. packet1.id = packet_in.id;
  4870. packet1.target_system = packet_in.target_system;
  4871. packet1.target_component = packet_in.target_component;
  4872. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  4873. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  4874. // cope with extensions
  4875. memset(MAVLINK_MSG_ID_LOG_REQUEST_DATA_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_LOG_REQUEST_DATA_MIN_LEN);
  4876. }
  4877. #endif
  4878. memset(&packet2, 0, sizeof(packet2));
  4879. mavlink_msg_log_request_data_encode(system_id, component_id, &msg, &packet1);
  4880. mavlink_msg_log_request_data_decode(&msg, &packet2);
  4881. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4882. memset(&packet2, 0, sizeof(packet2));
  4883. mavlink_msg_log_request_data_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.id , packet1.ofs , packet1.count );
  4884. mavlink_msg_log_request_data_decode(&msg, &packet2);
  4885. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4886. memset(&packet2, 0, sizeof(packet2));
  4887. mavlink_msg_log_request_data_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.id , packet1.ofs , packet1.count );
  4888. mavlink_msg_log_request_data_decode(&msg, &packet2);
  4889. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4890. memset(&packet2, 0, sizeof(packet2));
  4891. mavlink_msg_to_send_buffer(buffer, &msg);
  4892. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  4893. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  4894. }
  4895. mavlink_msg_log_request_data_decode(last_msg, &packet2);
  4896. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4897. memset(&packet2, 0, sizeof(packet2));
  4898. mavlink_msg_log_request_data_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.id , packet1.ofs , packet1.count );
  4899. mavlink_msg_log_request_data_decode(last_msg, &packet2);
  4900. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4901. }
  4902. static void mavlink_test_log_data(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  4903. {
  4904. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  4905. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  4906. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_LOG_DATA >= 256) {
  4907. return;
  4908. }
  4909. #endif
  4910. mavlink_message_t msg;
  4911. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  4912. uint16_t i;
  4913. mavlink_log_data_t packet_in = {
  4914. 963497464,17443,151,{ 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51 }
  4915. };
  4916. mavlink_log_data_t packet1, packet2;
  4917. memset(&packet1, 0, sizeof(packet1));
  4918. packet1.ofs = packet_in.ofs;
  4919. packet1.id = packet_in.id;
  4920. packet1.count = packet_in.count;
  4921. mav_array_memcpy(packet1.data, packet_in.data, sizeof(uint8_t)*90);
  4922. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  4923. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  4924. // cope with extensions
  4925. memset(MAVLINK_MSG_ID_LOG_DATA_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_LOG_DATA_MIN_LEN);
  4926. }
  4927. #endif
  4928. memset(&packet2, 0, sizeof(packet2));
  4929. mavlink_msg_log_data_encode(system_id, component_id, &msg, &packet1);
  4930. mavlink_msg_log_data_decode(&msg, &packet2);
  4931. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4932. memset(&packet2, 0, sizeof(packet2));
  4933. mavlink_msg_log_data_pack(system_id, component_id, &msg , packet1.id , packet1.ofs , packet1.count , packet1.data );
  4934. mavlink_msg_log_data_decode(&msg, &packet2);
  4935. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4936. memset(&packet2, 0, sizeof(packet2));
  4937. mavlink_msg_log_data_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.id , packet1.ofs , packet1.count , packet1.data );
  4938. mavlink_msg_log_data_decode(&msg, &packet2);
  4939. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4940. memset(&packet2, 0, sizeof(packet2));
  4941. mavlink_msg_to_send_buffer(buffer, &msg);
  4942. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  4943. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  4944. }
  4945. mavlink_msg_log_data_decode(last_msg, &packet2);
  4946. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4947. memset(&packet2, 0, sizeof(packet2));
  4948. mavlink_msg_log_data_send(MAVLINK_COMM_1 , packet1.id , packet1.ofs , packet1.count , packet1.data );
  4949. mavlink_msg_log_data_decode(last_msg, &packet2);
  4950. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4951. }
  4952. static void mavlink_test_log_erase(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  4953. {
  4954. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  4955. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  4956. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_LOG_ERASE >= 256) {
  4957. return;
  4958. }
  4959. #endif
  4960. mavlink_message_t msg;
  4961. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  4962. uint16_t i;
  4963. mavlink_log_erase_t packet_in = {
  4964. 5,72
  4965. };
  4966. mavlink_log_erase_t packet1, packet2;
  4967. memset(&packet1, 0, sizeof(packet1));
  4968. packet1.target_system = packet_in.target_system;
  4969. packet1.target_component = packet_in.target_component;
  4970. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  4971. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  4972. // cope with extensions
  4973. memset(MAVLINK_MSG_ID_LOG_ERASE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_LOG_ERASE_MIN_LEN);
  4974. }
  4975. #endif
  4976. memset(&packet2, 0, sizeof(packet2));
  4977. mavlink_msg_log_erase_encode(system_id, component_id, &msg, &packet1);
  4978. mavlink_msg_log_erase_decode(&msg, &packet2);
  4979. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4980. memset(&packet2, 0, sizeof(packet2));
  4981. mavlink_msg_log_erase_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component );
  4982. mavlink_msg_log_erase_decode(&msg, &packet2);
  4983. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4984. memset(&packet2, 0, sizeof(packet2));
  4985. mavlink_msg_log_erase_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component );
  4986. mavlink_msg_log_erase_decode(&msg, &packet2);
  4987. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4988. memset(&packet2, 0, sizeof(packet2));
  4989. mavlink_msg_to_send_buffer(buffer, &msg);
  4990. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  4991. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  4992. }
  4993. mavlink_msg_log_erase_decode(last_msg, &packet2);
  4994. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4995. memset(&packet2, 0, sizeof(packet2));
  4996. mavlink_msg_log_erase_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component );
  4997. mavlink_msg_log_erase_decode(last_msg, &packet2);
  4998. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  4999. }
  5000. static void mavlink_test_log_request_end(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  5001. {
  5002. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5003. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  5004. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_LOG_REQUEST_END >= 256) {
  5005. return;
  5006. }
  5007. #endif
  5008. mavlink_message_t msg;
  5009. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  5010. uint16_t i;
  5011. mavlink_log_request_end_t packet_in = {
  5012. 5,72
  5013. };
  5014. mavlink_log_request_end_t packet1, packet2;
  5015. memset(&packet1, 0, sizeof(packet1));
  5016. packet1.target_system = packet_in.target_system;
  5017. packet1.target_component = packet_in.target_component;
  5018. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5019. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  5020. // cope with extensions
  5021. memset(MAVLINK_MSG_ID_LOG_REQUEST_END_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_LOG_REQUEST_END_MIN_LEN);
  5022. }
  5023. #endif
  5024. memset(&packet2, 0, sizeof(packet2));
  5025. mavlink_msg_log_request_end_encode(system_id, component_id, &msg, &packet1);
  5026. mavlink_msg_log_request_end_decode(&msg, &packet2);
  5027. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5028. memset(&packet2, 0, sizeof(packet2));
  5029. mavlink_msg_log_request_end_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component );
  5030. mavlink_msg_log_request_end_decode(&msg, &packet2);
  5031. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5032. memset(&packet2, 0, sizeof(packet2));
  5033. mavlink_msg_log_request_end_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component );
  5034. mavlink_msg_log_request_end_decode(&msg, &packet2);
  5035. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5036. memset(&packet2, 0, sizeof(packet2));
  5037. mavlink_msg_to_send_buffer(buffer, &msg);
  5038. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  5039. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  5040. }
  5041. mavlink_msg_log_request_end_decode(last_msg, &packet2);
  5042. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5043. memset(&packet2, 0, sizeof(packet2));
  5044. mavlink_msg_log_request_end_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component );
  5045. mavlink_msg_log_request_end_decode(last_msg, &packet2);
  5046. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5047. }
  5048. static void mavlink_test_gps_inject_data(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  5049. {
  5050. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5051. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  5052. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GPS_INJECT_DATA >= 256) {
  5053. return;
  5054. }
  5055. #endif
  5056. mavlink_message_t msg;
  5057. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  5058. uint16_t i;
  5059. mavlink_gps_inject_data_t packet_in = {
  5060. 5,72,139,{ 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59 }
  5061. };
  5062. mavlink_gps_inject_data_t packet1, packet2;
  5063. memset(&packet1, 0, sizeof(packet1));
  5064. packet1.target_system = packet_in.target_system;
  5065. packet1.target_component = packet_in.target_component;
  5066. packet1.len = packet_in.len;
  5067. mav_array_memcpy(packet1.data, packet_in.data, sizeof(uint8_t)*110);
  5068. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5069. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  5070. // cope with extensions
  5071. memset(MAVLINK_MSG_ID_GPS_INJECT_DATA_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GPS_INJECT_DATA_MIN_LEN);
  5072. }
  5073. #endif
  5074. memset(&packet2, 0, sizeof(packet2));
  5075. mavlink_msg_gps_inject_data_encode(system_id, component_id, &msg, &packet1);
  5076. mavlink_msg_gps_inject_data_decode(&msg, &packet2);
  5077. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5078. memset(&packet2, 0, sizeof(packet2));
  5079. mavlink_msg_gps_inject_data_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.len , packet1.data );
  5080. mavlink_msg_gps_inject_data_decode(&msg, &packet2);
  5081. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5082. memset(&packet2, 0, sizeof(packet2));
  5083. mavlink_msg_gps_inject_data_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.len , packet1.data );
  5084. mavlink_msg_gps_inject_data_decode(&msg, &packet2);
  5085. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5086. memset(&packet2, 0, sizeof(packet2));
  5087. mavlink_msg_to_send_buffer(buffer, &msg);
  5088. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  5089. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  5090. }
  5091. mavlink_msg_gps_inject_data_decode(last_msg, &packet2);
  5092. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5093. memset(&packet2, 0, sizeof(packet2));
  5094. mavlink_msg_gps_inject_data_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.len , packet1.data );
  5095. mavlink_msg_gps_inject_data_decode(last_msg, &packet2);
  5096. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5097. }
  5098. static void mavlink_test_gps2_raw(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  5099. {
  5100. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5101. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  5102. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GPS2_RAW >= 256) {
  5103. return;
  5104. }
  5105. #endif
  5106. mavlink_message_t msg;
  5107. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  5108. uint16_t i;
  5109. mavlink_gps2_raw_t packet_in = {
  5110. 93372036854775807ULL,963497880,963498088,963498296,963498504,18483,18587,18691,18795,101,168,235
  5111. };
  5112. mavlink_gps2_raw_t packet1, packet2;
  5113. memset(&packet1, 0, sizeof(packet1));
  5114. packet1.time_usec = packet_in.time_usec;
  5115. packet1.lat = packet_in.lat;
  5116. packet1.lon = packet_in.lon;
  5117. packet1.alt = packet_in.alt;
  5118. packet1.dgps_age = packet_in.dgps_age;
  5119. packet1.eph = packet_in.eph;
  5120. packet1.epv = packet_in.epv;
  5121. packet1.vel = packet_in.vel;
  5122. packet1.cog = packet_in.cog;
  5123. packet1.fix_type = packet_in.fix_type;
  5124. packet1.satellites_visible = packet_in.satellites_visible;
  5125. packet1.dgps_numch = packet_in.dgps_numch;
  5126. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5127. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  5128. // cope with extensions
  5129. memset(MAVLINK_MSG_ID_GPS2_RAW_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GPS2_RAW_MIN_LEN);
  5130. }
  5131. #endif
  5132. memset(&packet2, 0, sizeof(packet2));
  5133. mavlink_msg_gps2_raw_encode(system_id, component_id, &msg, &packet1);
  5134. mavlink_msg_gps2_raw_decode(&msg, &packet2);
  5135. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5136. memset(&packet2, 0, sizeof(packet2));
  5137. mavlink_msg_gps2_raw_pack(system_id, component_id, &msg , packet1.time_usec , packet1.fix_type , packet1.lat , packet1.lon , packet1.alt , packet1.eph , packet1.epv , packet1.vel , packet1.cog , packet1.satellites_visible , packet1.dgps_numch , packet1.dgps_age );
  5138. mavlink_msg_gps2_raw_decode(&msg, &packet2);
  5139. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5140. memset(&packet2, 0, sizeof(packet2));
  5141. mavlink_msg_gps2_raw_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.fix_type , packet1.lat , packet1.lon , packet1.alt , packet1.eph , packet1.epv , packet1.vel , packet1.cog , packet1.satellites_visible , packet1.dgps_numch , packet1.dgps_age );
  5142. mavlink_msg_gps2_raw_decode(&msg, &packet2);
  5143. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5144. memset(&packet2, 0, sizeof(packet2));
  5145. mavlink_msg_to_send_buffer(buffer, &msg);
  5146. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  5147. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  5148. }
  5149. mavlink_msg_gps2_raw_decode(last_msg, &packet2);
  5150. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5151. memset(&packet2, 0, sizeof(packet2));
  5152. mavlink_msg_gps2_raw_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.fix_type , packet1.lat , packet1.lon , packet1.alt , packet1.eph , packet1.epv , packet1.vel , packet1.cog , packet1.satellites_visible , packet1.dgps_numch , packet1.dgps_age );
  5153. mavlink_msg_gps2_raw_decode(last_msg, &packet2);
  5154. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5155. }
  5156. static void mavlink_test_power_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  5157. {
  5158. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5159. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  5160. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_POWER_STATUS >= 256) {
  5161. return;
  5162. }
  5163. #endif
  5164. mavlink_message_t msg;
  5165. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  5166. uint16_t i;
  5167. mavlink_power_status_t packet_in = {
  5168. 17235,17339,17443
  5169. };
  5170. mavlink_power_status_t packet1, packet2;
  5171. memset(&packet1, 0, sizeof(packet1));
  5172. packet1.Vcc = packet_in.Vcc;
  5173. packet1.Vservo = packet_in.Vservo;
  5174. packet1.flags = packet_in.flags;
  5175. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5176. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  5177. // cope with extensions
  5178. memset(MAVLINK_MSG_ID_POWER_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_POWER_STATUS_MIN_LEN);
  5179. }
  5180. #endif
  5181. memset(&packet2, 0, sizeof(packet2));
  5182. mavlink_msg_power_status_encode(system_id, component_id, &msg, &packet1);
  5183. mavlink_msg_power_status_decode(&msg, &packet2);
  5184. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5185. memset(&packet2, 0, sizeof(packet2));
  5186. mavlink_msg_power_status_pack(system_id, component_id, &msg , packet1.Vcc , packet1.Vservo , packet1.flags );
  5187. mavlink_msg_power_status_decode(&msg, &packet2);
  5188. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5189. memset(&packet2, 0, sizeof(packet2));
  5190. mavlink_msg_power_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.Vcc , packet1.Vservo , packet1.flags );
  5191. mavlink_msg_power_status_decode(&msg, &packet2);
  5192. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5193. memset(&packet2, 0, sizeof(packet2));
  5194. mavlink_msg_to_send_buffer(buffer, &msg);
  5195. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  5196. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  5197. }
  5198. mavlink_msg_power_status_decode(last_msg, &packet2);
  5199. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5200. memset(&packet2, 0, sizeof(packet2));
  5201. mavlink_msg_power_status_send(MAVLINK_COMM_1 , packet1.Vcc , packet1.Vservo , packet1.flags );
  5202. mavlink_msg_power_status_decode(last_msg, &packet2);
  5203. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5204. }
  5205. static void mavlink_test_serial_control(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  5206. {
  5207. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5208. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  5209. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SERIAL_CONTROL >= 256) {
  5210. return;
  5211. }
  5212. #endif
  5213. mavlink_message_t msg;
  5214. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  5215. uint16_t i;
  5216. mavlink_serial_control_t packet_in = {
  5217. 963497464,17443,151,218,29,{ 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165 }
  5218. };
  5219. mavlink_serial_control_t packet1, packet2;
  5220. memset(&packet1, 0, sizeof(packet1));
  5221. packet1.baudrate = packet_in.baudrate;
  5222. packet1.timeout = packet_in.timeout;
  5223. packet1.device = packet_in.device;
  5224. packet1.flags = packet_in.flags;
  5225. packet1.count = packet_in.count;
  5226. mav_array_memcpy(packet1.data, packet_in.data, sizeof(uint8_t)*70);
  5227. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5228. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  5229. // cope with extensions
  5230. memset(MAVLINK_MSG_ID_SERIAL_CONTROL_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SERIAL_CONTROL_MIN_LEN);
  5231. }
  5232. #endif
  5233. memset(&packet2, 0, sizeof(packet2));
  5234. mavlink_msg_serial_control_encode(system_id, component_id, &msg, &packet1);
  5235. mavlink_msg_serial_control_decode(&msg, &packet2);
  5236. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5237. memset(&packet2, 0, sizeof(packet2));
  5238. mavlink_msg_serial_control_pack(system_id, component_id, &msg , packet1.device , packet1.flags , packet1.timeout , packet1.baudrate , packet1.count , packet1.data );
  5239. mavlink_msg_serial_control_decode(&msg, &packet2);
  5240. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5241. memset(&packet2, 0, sizeof(packet2));
  5242. mavlink_msg_serial_control_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.device , packet1.flags , packet1.timeout , packet1.baudrate , packet1.count , packet1.data );
  5243. mavlink_msg_serial_control_decode(&msg, &packet2);
  5244. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5245. memset(&packet2, 0, sizeof(packet2));
  5246. mavlink_msg_to_send_buffer(buffer, &msg);
  5247. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  5248. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  5249. }
  5250. mavlink_msg_serial_control_decode(last_msg, &packet2);
  5251. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5252. memset(&packet2, 0, sizeof(packet2));
  5253. mavlink_msg_serial_control_send(MAVLINK_COMM_1 , packet1.device , packet1.flags , packet1.timeout , packet1.baudrate , packet1.count , packet1.data );
  5254. mavlink_msg_serial_control_decode(last_msg, &packet2);
  5255. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5256. }
  5257. static void mavlink_test_gps_rtk(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  5258. {
  5259. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5260. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  5261. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GPS_RTK >= 256) {
  5262. return;
  5263. }
  5264. #endif
  5265. mavlink_message_t msg;
  5266. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  5267. uint16_t i;
  5268. mavlink_gps_rtk_t packet_in = {
  5269. 963497464,963497672,963497880,963498088,963498296,963498504,963498712,18691,223,34,101,168,235
  5270. };
  5271. mavlink_gps_rtk_t packet1, packet2;
  5272. memset(&packet1, 0, sizeof(packet1));
  5273. packet1.time_last_baseline_ms = packet_in.time_last_baseline_ms;
  5274. packet1.tow = packet_in.tow;
  5275. packet1.baseline_a_mm = packet_in.baseline_a_mm;
  5276. packet1.baseline_b_mm = packet_in.baseline_b_mm;
  5277. packet1.baseline_c_mm = packet_in.baseline_c_mm;
  5278. packet1.accuracy = packet_in.accuracy;
  5279. packet1.iar_num_hypotheses = packet_in.iar_num_hypotheses;
  5280. packet1.wn = packet_in.wn;
  5281. packet1.rtk_receiver_id = packet_in.rtk_receiver_id;
  5282. packet1.rtk_health = packet_in.rtk_health;
  5283. packet1.rtk_rate = packet_in.rtk_rate;
  5284. packet1.nsats = packet_in.nsats;
  5285. packet1.baseline_coords_type = packet_in.baseline_coords_type;
  5286. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5287. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  5288. // cope with extensions
  5289. memset(MAVLINK_MSG_ID_GPS_RTK_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GPS_RTK_MIN_LEN);
  5290. }
  5291. #endif
  5292. memset(&packet2, 0, sizeof(packet2));
  5293. mavlink_msg_gps_rtk_encode(system_id, component_id, &msg, &packet1);
  5294. mavlink_msg_gps_rtk_decode(&msg, &packet2);
  5295. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5296. memset(&packet2, 0, sizeof(packet2));
  5297. mavlink_msg_gps_rtk_pack(system_id, component_id, &msg , packet1.time_last_baseline_ms , packet1.rtk_receiver_id , packet1.wn , packet1.tow , packet1.rtk_health , packet1.rtk_rate , packet1.nsats , packet1.baseline_coords_type , packet1.baseline_a_mm , packet1.baseline_b_mm , packet1.baseline_c_mm , packet1.accuracy , packet1.iar_num_hypotheses );
  5298. mavlink_msg_gps_rtk_decode(&msg, &packet2);
  5299. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5300. memset(&packet2, 0, sizeof(packet2));
  5301. mavlink_msg_gps_rtk_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_last_baseline_ms , packet1.rtk_receiver_id , packet1.wn , packet1.tow , packet1.rtk_health , packet1.rtk_rate , packet1.nsats , packet1.baseline_coords_type , packet1.baseline_a_mm , packet1.baseline_b_mm , packet1.baseline_c_mm , packet1.accuracy , packet1.iar_num_hypotheses );
  5302. mavlink_msg_gps_rtk_decode(&msg, &packet2);
  5303. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5304. memset(&packet2, 0, sizeof(packet2));
  5305. mavlink_msg_to_send_buffer(buffer, &msg);
  5306. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  5307. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  5308. }
  5309. mavlink_msg_gps_rtk_decode(last_msg, &packet2);
  5310. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5311. memset(&packet2, 0, sizeof(packet2));
  5312. mavlink_msg_gps_rtk_send(MAVLINK_COMM_1 , packet1.time_last_baseline_ms , packet1.rtk_receiver_id , packet1.wn , packet1.tow , packet1.rtk_health , packet1.rtk_rate , packet1.nsats , packet1.baseline_coords_type , packet1.baseline_a_mm , packet1.baseline_b_mm , packet1.baseline_c_mm , packet1.accuracy , packet1.iar_num_hypotheses );
  5313. mavlink_msg_gps_rtk_decode(last_msg, &packet2);
  5314. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5315. }
  5316. static void mavlink_test_gps2_rtk(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  5317. {
  5318. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5319. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  5320. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GPS2_RTK >= 256) {
  5321. return;
  5322. }
  5323. #endif
  5324. mavlink_message_t msg;
  5325. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  5326. uint16_t i;
  5327. mavlink_gps2_rtk_t packet_in = {
  5328. 963497464,963497672,963497880,963498088,963498296,963498504,963498712,18691,223,34,101,168,235
  5329. };
  5330. mavlink_gps2_rtk_t packet1, packet2;
  5331. memset(&packet1, 0, sizeof(packet1));
  5332. packet1.time_last_baseline_ms = packet_in.time_last_baseline_ms;
  5333. packet1.tow = packet_in.tow;
  5334. packet1.baseline_a_mm = packet_in.baseline_a_mm;
  5335. packet1.baseline_b_mm = packet_in.baseline_b_mm;
  5336. packet1.baseline_c_mm = packet_in.baseline_c_mm;
  5337. packet1.accuracy = packet_in.accuracy;
  5338. packet1.iar_num_hypotheses = packet_in.iar_num_hypotheses;
  5339. packet1.wn = packet_in.wn;
  5340. packet1.rtk_receiver_id = packet_in.rtk_receiver_id;
  5341. packet1.rtk_health = packet_in.rtk_health;
  5342. packet1.rtk_rate = packet_in.rtk_rate;
  5343. packet1.nsats = packet_in.nsats;
  5344. packet1.baseline_coords_type = packet_in.baseline_coords_type;
  5345. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5346. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  5347. // cope with extensions
  5348. memset(MAVLINK_MSG_ID_GPS2_RTK_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GPS2_RTK_MIN_LEN);
  5349. }
  5350. #endif
  5351. memset(&packet2, 0, sizeof(packet2));
  5352. mavlink_msg_gps2_rtk_encode(system_id, component_id, &msg, &packet1);
  5353. mavlink_msg_gps2_rtk_decode(&msg, &packet2);
  5354. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5355. memset(&packet2, 0, sizeof(packet2));
  5356. mavlink_msg_gps2_rtk_pack(system_id, component_id, &msg , packet1.time_last_baseline_ms , packet1.rtk_receiver_id , packet1.wn , packet1.tow , packet1.rtk_health , packet1.rtk_rate , packet1.nsats , packet1.baseline_coords_type , packet1.baseline_a_mm , packet1.baseline_b_mm , packet1.baseline_c_mm , packet1.accuracy , packet1.iar_num_hypotheses );
  5357. mavlink_msg_gps2_rtk_decode(&msg, &packet2);
  5358. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5359. memset(&packet2, 0, sizeof(packet2));
  5360. mavlink_msg_gps2_rtk_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_last_baseline_ms , packet1.rtk_receiver_id , packet1.wn , packet1.tow , packet1.rtk_health , packet1.rtk_rate , packet1.nsats , packet1.baseline_coords_type , packet1.baseline_a_mm , packet1.baseline_b_mm , packet1.baseline_c_mm , packet1.accuracy , packet1.iar_num_hypotheses );
  5361. mavlink_msg_gps2_rtk_decode(&msg, &packet2);
  5362. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5363. memset(&packet2, 0, sizeof(packet2));
  5364. mavlink_msg_to_send_buffer(buffer, &msg);
  5365. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  5366. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  5367. }
  5368. mavlink_msg_gps2_rtk_decode(last_msg, &packet2);
  5369. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5370. memset(&packet2, 0, sizeof(packet2));
  5371. mavlink_msg_gps2_rtk_send(MAVLINK_COMM_1 , packet1.time_last_baseline_ms , packet1.rtk_receiver_id , packet1.wn , packet1.tow , packet1.rtk_health , packet1.rtk_rate , packet1.nsats , packet1.baseline_coords_type , packet1.baseline_a_mm , packet1.baseline_b_mm , packet1.baseline_c_mm , packet1.accuracy , packet1.iar_num_hypotheses );
  5372. mavlink_msg_gps2_rtk_decode(last_msg, &packet2);
  5373. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5374. }
  5375. static void mavlink_test_scaled_imu3(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  5376. {
  5377. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5378. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  5379. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SCALED_IMU3 >= 256) {
  5380. return;
  5381. }
  5382. #endif
  5383. mavlink_message_t msg;
  5384. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  5385. uint16_t i;
  5386. mavlink_scaled_imu3_t packet_in = {
  5387. 963497464,17443,17547,17651,17755,17859,17963,18067,18171,18275,18379
  5388. };
  5389. mavlink_scaled_imu3_t packet1, packet2;
  5390. memset(&packet1, 0, sizeof(packet1));
  5391. packet1.time_boot_ms = packet_in.time_boot_ms;
  5392. packet1.xacc = packet_in.xacc;
  5393. packet1.yacc = packet_in.yacc;
  5394. packet1.zacc = packet_in.zacc;
  5395. packet1.xgyro = packet_in.xgyro;
  5396. packet1.ygyro = packet_in.ygyro;
  5397. packet1.zgyro = packet_in.zgyro;
  5398. packet1.xmag = packet_in.xmag;
  5399. packet1.ymag = packet_in.ymag;
  5400. packet1.zmag = packet_in.zmag;
  5401. packet1.temperature = packet_in.temperature;
  5402. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5403. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  5404. // cope with extensions
  5405. memset(MAVLINK_MSG_ID_SCALED_IMU3_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SCALED_IMU3_MIN_LEN);
  5406. }
  5407. #endif
  5408. memset(&packet2, 0, sizeof(packet2));
  5409. mavlink_msg_scaled_imu3_encode(system_id, component_id, &msg, &packet1);
  5410. mavlink_msg_scaled_imu3_decode(&msg, &packet2);
  5411. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5412. memset(&packet2, 0, sizeof(packet2));
  5413. mavlink_msg_scaled_imu3_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag , packet1.temperature );
  5414. mavlink_msg_scaled_imu3_decode(&msg, &packet2);
  5415. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5416. memset(&packet2, 0, sizeof(packet2));
  5417. mavlink_msg_scaled_imu3_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag , packet1.temperature );
  5418. mavlink_msg_scaled_imu3_decode(&msg, &packet2);
  5419. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5420. memset(&packet2, 0, sizeof(packet2));
  5421. mavlink_msg_to_send_buffer(buffer, &msg);
  5422. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  5423. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  5424. }
  5425. mavlink_msg_scaled_imu3_decode(last_msg, &packet2);
  5426. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5427. memset(&packet2, 0, sizeof(packet2));
  5428. mavlink_msg_scaled_imu3_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag , packet1.temperature );
  5429. mavlink_msg_scaled_imu3_decode(last_msg, &packet2);
  5430. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5431. }
  5432. static void mavlink_test_data_transmission_handshake(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  5433. {
  5434. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5435. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  5436. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE >= 256) {
  5437. return;
  5438. }
  5439. #endif
  5440. mavlink_message_t msg;
  5441. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  5442. uint16_t i;
  5443. mavlink_data_transmission_handshake_t packet_in = {
  5444. 963497464,17443,17547,17651,163,230,41
  5445. };
  5446. mavlink_data_transmission_handshake_t packet1, packet2;
  5447. memset(&packet1, 0, sizeof(packet1));
  5448. packet1.size = packet_in.size;
  5449. packet1.width = packet_in.width;
  5450. packet1.height = packet_in.height;
  5451. packet1.packets = packet_in.packets;
  5452. packet1.type = packet_in.type;
  5453. packet1.payload = packet_in.payload;
  5454. packet1.jpg_quality = packet_in.jpg_quality;
  5455. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5456. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  5457. // cope with extensions
  5458. memset(MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_MIN_LEN);
  5459. }
  5460. #endif
  5461. memset(&packet2, 0, sizeof(packet2));
  5462. mavlink_msg_data_transmission_handshake_encode(system_id, component_id, &msg, &packet1);
  5463. mavlink_msg_data_transmission_handshake_decode(&msg, &packet2);
  5464. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5465. memset(&packet2, 0, sizeof(packet2));
  5466. mavlink_msg_data_transmission_handshake_pack(system_id, component_id, &msg , packet1.type , packet1.size , packet1.width , packet1.height , packet1.packets , packet1.payload , packet1.jpg_quality );
  5467. mavlink_msg_data_transmission_handshake_decode(&msg, &packet2);
  5468. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5469. memset(&packet2, 0, sizeof(packet2));
  5470. mavlink_msg_data_transmission_handshake_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.type , packet1.size , packet1.width , packet1.height , packet1.packets , packet1.payload , packet1.jpg_quality );
  5471. mavlink_msg_data_transmission_handshake_decode(&msg, &packet2);
  5472. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5473. memset(&packet2, 0, sizeof(packet2));
  5474. mavlink_msg_to_send_buffer(buffer, &msg);
  5475. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  5476. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  5477. }
  5478. mavlink_msg_data_transmission_handshake_decode(last_msg, &packet2);
  5479. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5480. memset(&packet2, 0, sizeof(packet2));
  5481. mavlink_msg_data_transmission_handshake_send(MAVLINK_COMM_1 , packet1.type , packet1.size , packet1.width , packet1.height , packet1.packets , packet1.payload , packet1.jpg_quality );
  5482. mavlink_msg_data_transmission_handshake_decode(last_msg, &packet2);
  5483. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5484. }
  5485. static void mavlink_test_encapsulated_data(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  5486. {
  5487. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5488. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  5489. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ENCAPSULATED_DATA >= 256) {
  5490. return;
  5491. }
  5492. #endif
  5493. mavlink_message_t msg;
  5494. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  5495. uint16_t i;
  5496. mavlink_encapsulated_data_t packet_in = {
  5497. 17235,{ 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135 }
  5498. };
  5499. mavlink_encapsulated_data_t packet1, packet2;
  5500. memset(&packet1, 0, sizeof(packet1));
  5501. packet1.seqnr = packet_in.seqnr;
  5502. mav_array_memcpy(packet1.data, packet_in.data, sizeof(uint8_t)*253);
  5503. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5504. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  5505. // cope with extensions
  5506. memset(MAVLINK_MSG_ID_ENCAPSULATED_DATA_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ENCAPSULATED_DATA_MIN_LEN);
  5507. }
  5508. #endif
  5509. memset(&packet2, 0, sizeof(packet2));
  5510. mavlink_msg_encapsulated_data_encode(system_id, component_id, &msg, &packet1);
  5511. mavlink_msg_encapsulated_data_decode(&msg, &packet2);
  5512. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5513. memset(&packet2, 0, sizeof(packet2));
  5514. mavlink_msg_encapsulated_data_pack(system_id, component_id, &msg , packet1.seqnr , packet1.data );
  5515. mavlink_msg_encapsulated_data_decode(&msg, &packet2);
  5516. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5517. memset(&packet2, 0, sizeof(packet2));
  5518. mavlink_msg_encapsulated_data_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.seqnr , packet1.data );
  5519. mavlink_msg_encapsulated_data_decode(&msg, &packet2);
  5520. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5521. memset(&packet2, 0, sizeof(packet2));
  5522. mavlink_msg_to_send_buffer(buffer, &msg);
  5523. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  5524. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  5525. }
  5526. mavlink_msg_encapsulated_data_decode(last_msg, &packet2);
  5527. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5528. memset(&packet2, 0, sizeof(packet2));
  5529. mavlink_msg_encapsulated_data_send(MAVLINK_COMM_1 , packet1.seqnr , packet1.data );
  5530. mavlink_msg_encapsulated_data_decode(last_msg, &packet2);
  5531. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5532. }
  5533. static void mavlink_test_distance_sensor(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  5534. {
  5535. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5536. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  5537. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_DISTANCE_SENSOR >= 256) {
  5538. return;
  5539. }
  5540. #endif
  5541. mavlink_message_t msg;
  5542. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  5543. uint16_t i;
  5544. mavlink_distance_sensor_t packet_in = {
  5545. 963497464,17443,17547,17651,163,230,41,108,115.0,143.0,{ 171.0, 172.0, 173.0, 174.0 }
  5546. };
  5547. mavlink_distance_sensor_t packet1, packet2;
  5548. memset(&packet1, 0, sizeof(packet1));
  5549. packet1.time_boot_ms = packet_in.time_boot_ms;
  5550. packet1.min_distance = packet_in.min_distance;
  5551. packet1.max_distance = packet_in.max_distance;
  5552. packet1.current_distance = packet_in.current_distance;
  5553. packet1.type = packet_in.type;
  5554. packet1.id = packet_in.id;
  5555. packet1.orientation = packet_in.orientation;
  5556. packet1.covariance = packet_in.covariance;
  5557. packet1.horizontal_fov = packet_in.horizontal_fov;
  5558. packet1.vertical_fov = packet_in.vertical_fov;
  5559. mav_array_memcpy(packet1.quaternion, packet_in.quaternion, sizeof(float)*4);
  5560. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5561. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  5562. // cope with extensions
  5563. memset(MAVLINK_MSG_ID_DISTANCE_SENSOR_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_DISTANCE_SENSOR_MIN_LEN);
  5564. }
  5565. #endif
  5566. memset(&packet2, 0, sizeof(packet2));
  5567. mavlink_msg_distance_sensor_encode(system_id, component_id, &msg, &packet1);
  5568. mavlink_msg_distance_sensor_decode(&msg, &packet2);
  5569. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5570. memset(&packet2, 0, sizeof(packet2));
  5571. mavlink_msg_distance_sensor_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.min_distance , packet1.max_distance , packet1.current_distance , packet1.type , packet1.id , packet1.orientation , packet1.covariance , packet1.horizontal_fov , packet1.vertical_fov , packet1.quaternion );
  5572. mavlink_msg_distance_sensor_decode(&msg, &packet2);
  5573. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5574. memset(&packet2, 0, sizeof(packet2));
  5575. mavlink_msg_distance_sensor_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.min_distance , packet1.max_distance , packet1.current_distance , packet1.type , packet1.id , packet1.orientation , packet1.covariance , packet1.horizontal_fov , packet1.vertical_fov , packet1.quaternion );
  5576. mavlink_msg_distance_sensor_decode(&msg, &packet2);
  5577. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5578. memset(&packet2, 0, sizeof(packet2));
  5579. mavlink_msg_to_send_buffer(buffer, &msg);
  5580. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  5581. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  5582. }
  5583. mavlink_msg_distance_sensor_decode(last_msg, &packet2);
  5584. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5585. memset(&packet2, 0, sizeof(packet2));
  5586. mavlink_msg_distance_sensor_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.min_distance , packet1.max_distance , packet1.current_distance , packet1.type , packet1.id , packet1.orientation , packet1.covariance , packet1.horizontal_fov , packet1.vertical_fov , packet1.quaternion );
  5587. mavlink_msg_distance_sensor_decode(last_msg, &packet2);
  5588. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5589. }
  5590. static void mavlink_test_terrain_request(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  5591. {
  5592. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5593. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  5594. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_TERRAIN_REQUEST >= 256) {
  5595. return;
  5596. }
  5597. #endif
  5598. mavlink_message_t msg;
  5599. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  5600. uint16_t i;
  5601. mavlink_terrain_request_t packet_in = {
  5602. 93372036854775807ULL,963497880,963498088,18067
  5603. };
  5604. mavlink_terrain_request_t packet1, packet2;
  5605. memset(&packet1, 0, sizeof(packet1));
  5606. packet1.mask = packet_in.mask;
  5607. packet1.lat = packet_in.lat;
  5608. packet1.lon = packet_in.lon;
  5609. packet1.grid_spacing = packet_in.grid_spacing;
  5610. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5611. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  5612. // cope with extensions
  5613. memset(MAVLINK_MSG_ID_TERRAIN_REQUEST_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_TERRAIN_REQUEST_MIN_LEN);
  5614. }
  5615. #endif
  5616. memset(&packet2, 0, sizeof(packet2));
  5617. mavlink_msg_terrain_request_encode(system_id, component_id, &msg, &packet1);
  5618. mavlink_msg_terrain_request_decode(&msg, &packet2);
  5619. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5620. memset(&packet2, 0, sizeof(packet2));
  5621. mavlink_msg_terrain_request_pack(system_id, component_id, &msg , packet1.lat , packet1.lon , packet1.grid_spacing , packet1.mask );
  5622. mavlink_msg_terrain_request_decode(&msg, &packet2);
  5623. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5624. memset(&packet2, 0, sizeof(packet2));
  5625. mavlink_msg_terrain_request_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.lat , packet1.lon , packet1.grid_spacing , packet1.mask );
  5626. mavlink_msg_terrain_request_decode(&msg, &packet2);
  5627. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5628. memset(&packet2, 0, sizeof(packet2));
  5629. mavlink_msg_to_send_buffer(buffer, &msg);
  5630. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  5631. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  5632. }
  5633. mavlink_msg_terrain_request_decode(last_msg, &packet2);
  5634. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5635. memset(&packet2, 0, sizeof(packet2));
  5636. mavlink_msg_terrain_request_send(MAVLINK_COMM_1 , packet1.lat , packet1.lon , packet1.grid_spacing , packet1.mask );
  5637. mavlink_msg_terrain_request_decode(last_msg, &packet2);
  5638. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5639. }
  5640. static void mavlink_test_terrain_data(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  5641. {
  5642. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5643. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  5644. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_TERRAIN_DATA >= 256) {
  5645. return;
  5646. }
  5647. #endif
  5648. mavlink_message_t msg;
  5649. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  5650. uint16_t i;
  5651. mavlink_terrain_data_t packet_in = {
  5652. 963497464,963497672,17651,{ 17755, 17756, 17757, 17758, 17759, 17760, 17761, 17762, 17763, 17764, 17765, 17766, 17767, 17768, 17769, 17770 },3
  5653. };
  5654. mavlink_terrain_data_t packet1, packet2;
  5655. memset(&packet1, 0, sizeof(packet1));
  5656. packet1.lat = packet_in.lat;
  5657. packet1.lon = packet_in.lon;
  5658. packet1.grid_spacing = packet_in.grid_spacing;
  5659. packet1.gridbit = packet_in.gridbit;
  5660. mav_array_memcpy(packet1.data, packet_in.data, sizeof(int16_t)*16);
  5661. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5662. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  5663. // cope with extensions
  5664. memset(MAVLINK_MSG_ID_TERRAIN_DATA_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_TERRAIN_DATA_MIN_LEN);
  5665. }
  5666. #endif
  5667. memset(&packet2, 0, sizeof(packet2));
  5668. mavlink_msg_terrain_data_encode(system_id, component_id, &msg, &packet1);
  5669. mavlink_msg_terrain_data_decode(&msg, &packet2);
  5670. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5671. memset(&packet2, 0, sizeof(packet2));
  5672. mavlink_msg_terrain_data_pack(system_id, component_id, &msg , packet1.lat , packet1.lon , packet1.grid_spacing , packet1.gridbit , packet1.data );
  5673. mavlink_msg_terrain_data_decode(&msg, &packet2);
  5674. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5675. memset(&packet2, 0, sizeof(packet2));
  5676. mavlink_msg_terrain_data_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.lat , packet1.lon , packet1.grid_spacing , packet1.gridbit , packet1.data );
  5677. mavlink_msg_terrain_data_decode(&msg, &packet2);
  5678. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5679. memset(&packet2, 0, sizeof(packet2));
  5680. mavlink_msg_to_send_buffer(buffer, &msg);
  5681. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  5682. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  5683. }
  5684. mavlink_msg_terrain_data_decode(last_msg, &packet2);
  5685. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5686. memset(&packet2, 0, sizeof(packet2));
  5687. mavlink_msg_terrain_data_send(MAVLINK_COMM_1 , packet1.lat , packet1.lon , packet1.grid_spacing , packet1.gridbit , packet1.data );
  5688. mavlink_msg_terrain_data_decode(last_msg, &packet2);
  5689. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5690. }
  5691. static void mavlink_test_terrain_check(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  5692. {
  5693. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5694. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  5695. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_TERRAIN_CHECK >= 256) {
  5696. return;
  5697. }
  5698. #endif
  5699. mavlink_message_t msg;
  5700. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  5701. uint16_t i;
  5702. mavlink_terrain_check_t packet_in = {
  5703. 963497464,963497672
  5704. };
  5705. mavlink_terrain_check_t packet1, packet2;
  5706. memset(&packet1, 0, sizeof(packet1));
  5707. packet1.lat = packet_in.lat;
  5708. packet1.lon = packet_in.lon;
  5709. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5710. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  5711. // cope with extensions
  5712. memset(MAVLINK_MSG_ID_TERRAIN_CHECK_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_TERRAIN_CHECK_MIN_LEN);
  5713. }
  5714. #endif
  5715. memset(&packet2, 0, sizeof(packet2));
  5716. mavlink_msg_terrain_check_encode(system_id, component_id, &msg, &packet1);
  5717. mavlink_msg_terrain_check_decode(&msg, &packet2);
  5718. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5719. memset(&packet2, 0, sizeof(packet2));
  5720. mavlink_msg_terrain_check_pack(system_id, component_id, &msg , packet1.lat , packet1.lon );
  5721. mavlink_msg_terrain_check_decode(&msg, &packet2);
  5722. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5723. memset(&packet2, 0, sizeof(packet2));
  5724. mavlink_msg_terrain_check_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.lat , packet1.lon );
  5725. mavlink_msg_terrain_check_decode(&msg, &packet2);
  5726. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5727. memset(&packet2, 0, sizeof(packet2));
  5728. mavlink_msg_to_send_buffer(buffer, &msg);
  5729. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  5730. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  5731. }
  5732. mavlink_msg_terrain_check_decode(last_msg, &packet2);
  5733. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5734. memset(&packet2, 0, sizeof(packet2));
  5735. mavlink_msg_terrain_check_send(MAVLINK_COMM_1 , packet1.lat , packet1.lon );
  5736. mavlink_msg_terrain_check_decode(last_msg, &packet2);
  5737. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5738. }
  5739. static void mavlink_test_terrain_report(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  5740. {
  5741. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5742. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  5743. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_TERRAIN_REPORT >= 256) {
  5744. return;
  5745. }
  5746. #endif
  5747. mavlink_message_t msg;
  5748. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  5749. uint16_t i;
  5750. mavlink_terrain_report_t packet_in = {
  5751. 963497464,963497672,73.0,101.0,18067,18171,18275
  5752. };
  5753. mavlink_terrain_report_t packet1, packet2;
  5754. memset(&packet1, 0, sizeof(packet1));
  5755. packet1.lat = packet_in.lat;
  5756. packet1.lon = packet_in.lon;
  5757. packet1.terrain_height = packet_in.terrain_height;
  5758. packet1.current_height = packet_in.current_height;
  5759. packet1.spacing = packet_in.spacing;
  5760. packet1.pending = packet_in.pending;
  5761. packet1.loaded = packet_in.loaded;
  5762. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5763. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  5764. // cope with extensions
  5765. memset(MAVLINK_MSG_ID_TERRAIN_REPORT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_TERRAIN_REPORT_MIN_LEN);
  5766. }
  5767. #endif
  5768. memset(&packet2, 0, sizeof(packet2));
  5769. mavlink_msg_terrain_report_encode(system_id, component_id, &msg, &packet1);
  5770. mavlink_msg_terrain_report_decode(&msg, &packet2);
  5771. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5772. memset(&packet2, 0, sizeof(packet2));
  5773. mavlink_msg_terrain_report_pack(system_id, component_id, &msg , packet1.lat , packet1.lon , packet1.spacing , packet1.terrain_height , packet1.current_height , packet1.pending , packet1.loaded );
  5774. mavlink_msg_terrain_report_decode(&msg, &packet2);
  5775. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5776. memset(&packet2, 0, sizeof(packet2));
  5777. mavlink_msg_terrain_report_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.lat , packet1.lon , packet1.spacing , packet1.terrain_height , packet1.current_height , packet1.pending , packet1.loaded );
  5778. mavlink_msg_terrain_report_decode(&msg, &packet2);
  5779. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5780. memset(&packet2, 0, sizeof(packet2));
  5781. mavlink_msg_to_send_buffer(buffer, &msg);
  5782. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  5783. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  5784. }
  5785. mavlink_msg_terrain_report_decode(last_msg, &packet2);
  5786. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5787. memset(&packet2, 0, sizeof(packet2));
  5788. mavlink_msg_terrain_report_send(MAVLINK_COMM_1 , packet1.lat , packet1.lon , packet1.spacing , packet1.terrain_height , packet1.current_height , packet1.pending , packet1.loaded );
  5789. mavlink_msg_terrain_report_decode(last_msg, &packet2);
  5790. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5791. }
  5792. static void mavlink_test_scaled_pressure2(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  5793. {
  5794. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5795. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  5796. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SCALED_PRESSURE2 >= 256) {
  5797. return;
  5798. }
  5799. #endif
  5800. mavlink_message_t msg;
  5801. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  5802. uint16_t i;
  5803. mavlink_scaled_pressure2_t packet_in = {
  5804. 963497464,45.0,73.0,17859
  5805. };
  5806. mavlink_scaled_pressure2_t packet1, packet2;
  5807. memset(&packet1, 0, sizeof(packet1));
  5808. packet1.time_boot_ms = packet_in.time_boot_ms;
  5809. packet1.press_abs = packet_in.press_abs;
  5810. packet1.press_diff = packet_in.press_diff;
  5811. packet1.temperature = packet_in.temperature;
  5812. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5813. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  5814. // cope with extensions
  5815. memset(MAVLINK_MSG_ID_SCALED_PRESSURE2_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SCALED_PRESSURE2_MIN_LEN);
  5816. }
  5817. #endif
  5818. memset(&packet2, 0, sizeof(packet2));
  5819. mavlink_msg_scaled_pressure2_encode(system_id, component_id, &msg, &packet1);
  5820. mavlink_msg_scaled_pressure2_decode(&msg, &packet2);
  5821. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5822. memset(&packet2, 0, sizeof(packet2));
  5823. mavlink_msg_scaled_pressure2_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.press_abs , packet1.press_diff , packet1.temperature );
  5824. mavlink_msg_scaled_pressure2_decode(&msg, &packet2);
  5825. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5826. memset(&packet2, 0, sizeof(packet2));
  5827. mavlink_msg_scaled_pressure2_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.press_abs , packet1.press_diff , packet1.temperature );
  5828. mavlink_msg_scaled_pressure2_decode(&msg, &packet2);
  5829. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5830. memset(&packet2, 0, sizeof(packet2));
  5831. mavlink_msg_to_send_buffer(buffer, &msg);
  5832. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  5833. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  5834. }
  5835. mavlink_msg_scaled_pressure2_decode(last_msg, &packet2);
  5836. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5837. memset(&packet2, 0, sizeof(packet2));
  5838. mavlink_msg_scaled_pressure2_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.press_abs , packet1.press_diff , packet1.temperature );
  5839. mavlink_msg_scaled_pressure2_decode(last_msg, &packet2);
  5840. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5841. }
  5842. static void mavlink_test_att_pos_mocap(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  5843. {
  5844. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5845. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  5846. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ATT_POS_MOCAP >= 256) {
  5847. return;
  5848. }
  5849. #endif
  5850. mavlink_message_t msg;
  5851. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  5852. uint16_t i;
  5853. mavlink_att_pos_mocap_t packet_in = {
  5854. 93372036854775807ULL,{ 73.0, 74.0, 75.0, 76.0 },185.0,213.0,241.0,{ 269.0, 270.0, 271.0, 272.0, 273.0, 274.0, 275.0, 276.0, 277.0, 278.0, 279.0, 280.0, 281.0, 282.0, 283.0, 284.0, 285.0, 286.0, 287.0, 288.0, 289.0 }
  5855. };
  5856. mavlink_att_pos_mocap_t packet1, packet2;
  5857. memset(&packet1, 0, sizeof(packet1));
  5858. packet1.time_usec = packet_in.time_usec;
  5859. packet1.x = packet_in.x;
  5860. packet1.y = packet_in.y;
  5861. packet1.z = packet_in.z;
  5862. mav_array_memcpy(packet1.q, packet_in.q, sizeof(float)*4);
  5863. mav_array_memcpy(packet1.covariance, packet_in.covariance, sizeof(float)*21);
  5864. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5865. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  5866. // cope with extensions
  5867. memset(MAVLINK_MSG_ID_ATT_POS_MOCAP_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ATT_POS_MOCAP_MIN_LEN);
  5868. }
  5869. #endif
  5870. memset(&packet2, 0, sizeof(packet2));
  5871. mavlink_msg_att_pos_mocap_encode(system_id, component_id, &msg, &packet1);
  5872. mavlink_msg_att_pos_mocap_decode(&msg, &packet2);
  5873. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5874. memset(&packet2, 0, sizeof(packet2));
  5875. mavlink_msg_att_pos_mocap_pack(system_id, component_id, &msg , packet1.time_usec , packet1.q , packet1.x , packet1.y , packet1.z , packet1.covariance );
  5876. mavlink_msg_att_pos_mocap_decode(&msg, &packet2);
  5877. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5878. memset(&packet2, 0, sizeof(packet2));
  5879. mavlink_msg_att_pos_mocap_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.q , packet1.x , packet1.y , packet1.z , packet1.covariance );
  5880. mavlink_msg_att_pos_mocap_decode(&msg, &packet2);
  5881. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5882. memset(&packet2, 0, sizeof(packet2));
  5883. mavlink_msg_to_send_buffer(buffer, &msg);
  5884. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  5885. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  5886. }
  5887. mavlink_msg_att_pos_mocap_decode(last_msg, &packet2);
  5888. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5889. memset(&packet2, 0, sizeof(packet2));
  5890. mavlink_msg_att_pos_mocap_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.q , packet1.x , packet1.y , packet1.z , packet1.covariance );
  5891. mavlink_msg_att_pos_mocap_decode(last_msg, &packet2);
  5892. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5893. }
  5894. static void mavlink_test_set_actuator_control_target(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  5895. {
  5896. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5897. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  5898. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET >= 256) {
  5899. return;
  5900. }
  5901. #endif
  5902. mavlink_message_t msg;
  5903. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  5904. uint16_t i;
  5905. mavlink_set_actuator_control_target_t packet_in = {
  5906. 93372036854775807ULL,{ 73.0, 74.0, 75.0, 76.0, 77.0, 78.0, 79.0, 80.0 },125,192,3
  5907. };
  5908. mavlink_set_actuator_control_target_t packet1, packet2;
  5909. memset(&packet1, 0, sizeof(packet1));
  5910. packet1.time_usec = packet_in.time_usec;
  5911. packet1.group_mlx = packet_in.group_mlx;
  5912. packet1.target_system = packet_in.target_system;
  5913. packet1.target_component = packet_in.target_component;
  5914. mav_array_memcpy(packet1.controls, packet_in.controls, sizeof(float)*8);
  5915. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5916. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  5917. // cope with extensions
  5918. memset(MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_MIN_LEN);
  5919. }
  5920. #endif
  5921. memset(&packet2, 0, sizeof(packet2));
  5922. mavlink_msg_set_actuator_control_target_encode(system_id, component_id, &msg, &packet1);
  5923. mavlink_msg_set_actuator_control_target_decode(&msg, &packet2);
  5924. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5925. memset(&packet2, 0, sizeof(packet2));
  5926. mavlink_msg_set_actuator_control_target_pack(system_id, component_id, &msg , packet1.time_usec , packet1.group_mlx , packet1.target_system , packet1.target_component , packet1.controls );
  5927. mavlink_msg_set_actuator_control_target_decode(&msg, &packet2);
  5928. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5929. memset(&packet2, 0, sizeof(packet2));
  5930. mavlink_msg_set_actuator_control_target_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.group_mlx , packet1.target_system , packet1.target_component , packet1.controls );
  5931. mavlink_msg_set_actuator_control_target_decode(&msg, &packet2);
  5932. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5933. memset(&packet2, 0, sizeof(packet2));
  5934. mavlink_msg_to_send_buffer(buffer, &msg);
  5935. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  5936. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  5937. }
  5938. mavlink_msg_set_actuator_control_target_decode(last_msg, &packet2);
  5939. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5940. memset(&packet2, 0, sizeof(packet2));
  5941. mavlink_msg_set_actuator_control_target_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.group_mlx , packet1.target_system , packet1.target_component , packet1.controls );
  5942. mavlink_msg_set_actuator_control_target_decode(last_msg, &packet2);
  5943. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5944. }
  5945. static void mavlink_test_actuator_control_target(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  5946. {
  5947. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5948. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  5949. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET >= 256) {
  5950. return;
  5951. }
  5952. #endif
  5953. mavlink_message_t msg;
  5954. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  5955. uint16_t i;
  5956. mavlink_actuator_control_target_t packet_in = {
  5957. 93372036854775807ULL,{ 73.0, 74.0, 75.0, 76.0, 77.0, 78.0, 79.0, 80.0 },125
  5958. };
  5959. mavlink_actuator_control_target_t packet1, packet2;
  5960. memset(&packet1, 0, sizeof(packet1));
  5961. packet1.time_usec = packet_in.time_usec;
  5962. packet1.group_mlx = packet_in.group_mlx;
  5963. mav_array_memcpy(packet1.controls, packet_in.controls, sizeof(float)*8);
  5964. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5965. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  5966. // cope with extensions
  5967. memset(MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_MIN_LEN);
  5968. }
  5969. #endif
  5970. memset(&packet2, 0, sizeof(packet2));
  5971. mavlink_msg_actuator_control_target_encode(system_id, component_id, &msg, &packet1);
  5972. mavlink_msg_actuator_control_target_decode(&msg, &packet2);
  5973. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5974. memset(&packet2, 0, sizeof(packet2));
  5975. mavlink_msg_actuator_control_target_pack(system_id, component_id, &msg , packet1.time_usec , packet1.group_mlx , packet1.controls );
  5976. mavlink_msg_actuator_control_target_decode(&msg, &packet2);
  5977. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5978. memset(&packet2, 0, sizeof(packet2));
  5979. mavlink_msg_actuator_control_target_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.group_mlx , packet1.controls );
  5980. mavlink_msg_actuator_control_target_decode(&msg, &packet2);
  5981. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5982. memset(&packet2, 0, sizeof(packet2));
  5983. mavlink_msg_to_send_buffer(buffer, &msg);
  5984. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  5985. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  5986. }
  5987. mavlink_msg_actuator_control_target_decode(last_msg, &packet2);
  5988. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5989. memset(&packet2, 0, sizeof(packet2));
  5990. mavlink_msg_actuator_control_target_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.group_mlx , packet1.controls );
  5991. mavlink_msg_actuator_control_target_decode(last_msg, &packet2);
  5992. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  5993. }
  5994. static void mavlink_test_altitude(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  5995. {
  5996. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  5997. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  5998. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ALTITUDE >= 256) {
  5999. return;
  6000. }
  6001. #endif
  6002. mavlink_message_t msg;
  6003. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  6004. uint16_t i;
  6005. mavlink_altitude_t packet_in = {
  6006. 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0
  6007. };
  6008. mavlink_altitude_t packet1, packet2;
  6009. memset(&packet1, 0, sizeof(packet1));
  6010. packet1.time_usec = packet_in.time_usec;
  6011. packet1.altitude_monotonic = packet_in.altitude_monotonic;
  6012. packet1.altitude_amsl = packet_in.altitude_amsl;
  6013. packet1.altitude_local = packet_in.altitude_local;
  6014. packet1.altitude_relative = packet_in.altitude_relative;
  6015. packet1.altitude_terrain = packet_in.altitude_terrain;
  6016. packet1.bottom_clearance = packet_in.bottom_clearance;
  6017. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  6018. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  6019. // cope with extensions
  6020. memset(MAVLINK_MSG_ID_ALTITUDE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ALTITUDE_MIN_LEN);
  6021. }
  6022. #endif
  6023. memset(&packet2, 0, sizeof(packet2));
  6024. mavlink_msg_altitude_encode(system_id, component_id, &msg, &packet1);
  6025. mavlink_msg_altitude_decode(&msg, &packet2);
  6026. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6027. memset(&packet2, 0, sizeof(packet2));
  6028. mavlink_msg_altitude_pack(system_id, component_id, &msg , packet1.time_usec , packet1.altitude_monotonic , packet1.altitude_amsl , packet1.altitude_local , packet1.altitude_relative , packet1.altitude_terrain , packet1.bottom_clearance );
  6029. mavlink_msg_altitude_decode(&msg, &packet2);
  6030. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6031. memset(&packet2, 0, sizeof(packet2));
  6032. mavlink_msg_altitude_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.altitude_monotonic , packet1.altitude_amsl , packet1.altitude_local , packet1.altitude_relative , packet1.altitude_terrain , packet1.bottom_clearance );
  6033. mavlink_msg_altitude_decode(&msg, &packet2);
  6034. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6035. memset(&packet2, 0, sizeof(packet2));
  6036. mavlink_msg_to_send_buffer(buffer, &msg);
  6037. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  6038. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  6039. }
  6040. mavlink_msg_altitude_decode(last_msg, &packet2);
  6041. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6042. memset(&packet2, 0, sizeof(packet2));
  6043. mavlink_msg_altitude_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.altitude_monotonic , packet1.altitude_amsl , packet1.altitude_local , packet1.altitude_relative , packet1.altitude_terrain , packet1.bottom_clearance );
  6044. mavlink_msg_altitude_decode(last_msg, &packet2);
  6045. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6046. }
  6047. static void mavlink_test_resource_request(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  6048. {
  6049. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  6050. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  6051. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_RESOURCE_REQUEST >= 256) {
  6052. return;
  6053. }
  6054. #endif
  6055. mavlink_message_t msg;
  6056. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  6057. uint16_t i;
  6058. mavlink_resource_request_t packet_in = {
  6059. 5,72,{ 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 0, 1, 2 },243,{ 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173 }
  6060. };
  6061. mavlink_resource_request_t packet1, packet2;
  6062. memset(&packet1, 0, sizeof(packet1));
  6063. packet1.request_id = packet_in.request_id;
  6064. packet1.uri_type = packet_in.uri_type;
  6065. packet1.transfer_type = packet_in.transfer_type;
  6066. mav_array_memcpy(packet1.uri, packet_in.uri, sizeof(uint8_t)*120);
  6067. mav_array_memcpy(packet1.storage, packet_in.storage, sizeof(uint8_t)*120);
  6068. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  6069. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  6070. // cope with extensions
  6071. memset(MAVLINK_MSG_ID_RESOURCE_REQUEST_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_RESOURCE_REQUEST_MIN_LEN);
  6072. }
  6073. #endif
  6074. memset(&packet2, 0, sizeof(packet2));
  6075. mavlink_msg_resource_request_encode(system_id, component_id, &msg, &packet1);
  6076. mavlink_msg_resource_request_decode(&msg, &packet2);
  6077. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6078. memset(&packet2, 0, sizeof(packet2));
  6079. mavlink_msg_resource_request_pack(system_id, component_id, &msg , packet1.request_id , packet1.uri_type , packet1.uri , packet1.transfer_type , packet1.storage );
  6080. mavlink_msg_resource_request_decode(&msg, &packet2);
  6081. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6082. memset(&packet2, 0, sizeof(packet2));
  6083. mavlink_msg_resource_request_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.request_id , packet1.uri_type , packet1.uri , packet1.transfer_type , packet1.storage );
  6084. mavlink_msg_resource_request_decode(&msg, &packet2);
  6085. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6086. memset(&packet2, 0, sizeof(packet2));
  6087. mavlink_msg_to_send_buffer(buffer, &msg);
  6088. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  6089. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  6090. }
  6091. mavlink_msg_resource_request_decode(last_msg, &packet2);
  6092. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6093. memset(&packet2, 0, sizeof(packet2));
  6094. mavlink_msg_resource_request_send(MAVLINK_COMM_1 , packet1.request_id , packet1.uri_type , packet1.uri , packet1.transfer_type , packet1.storage );
  6095. mavlink_msg_resource_request_decode(last_msg, &packet2);
  6096. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6097. }
  6098. static void mavlink_test_scaled_pressure3(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  6099. {
  6100. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  6101. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  6102. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SCALED_PRESSURE3 >= 256) {
  6103. return;
  6104. }
  6105. #endif
  6106. mavlink_message_t msg;
  6107. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  6108. uint16_t i;
  6109. mavlink_scaled_pressure3_t packet_in = {
  6110. 963497464,45.0,73.0,17859
  6111. };
  6112. mavlink_scaled_pressure3_t packet1, packet2;
  6113. memset(&packet1, 0, sizeof(packet1));
  6114. packet1.time_boot_ms = packet_in.time_boot_ms;
  6115. packet1.press_abs = packet_in.press_abs;
  6116. packet1.press_diff = packet_in.press_diff;
  6117. packet1.temperature = packet_in.temperature;
  6118. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  6119. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  6120. // cope with extensions
  6121. memset(MAVLINK_MSG_ID_SCALED_PRESSURE3_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SCALED_PRESSURE3_MIN_LEN);
  6122. }
  6123. #endif
  6124. memset(&packet2, 0, sizeof(packet2));
  6125. mavlink_msg_scaled_pressure3_encode(system_id, component_id, &msg, &packet1);
  6126. mavlink_msg_scaled_pressure3_decode(&msg, &packet2);
  6127. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6128. memset(&packet2, 0, sizeof(packet2));
  6129. mavlink_msg_scaled_pressure3_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.press_abs , packet1.press_diff , packet1.temperature );
  6130. mavlink_msg_scaled_pressure3_decode(&msg, &packet2);
  6131. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6132. memset(&packet2, 0, sizeof(packet2));
  6133. mavlink_msg_scaled_pressure3_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.press_abs , packet1.press_diff , packet1.temperature );
  6134. mavlink_msg_scaled_pressure3_decode(&msg, &packet2);
  6135. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6136. memset(&packet2, 0, sizeof(packet2));
  6137. mavlink_msg_to_send_buffer(buffer, &msg);
  6138. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  6139. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  6140. }
  6141. mavlink_msg_scaled_pressure3_decode(last_msg, &packet2);
  6142. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6143. memset(&packet2, 0, sizeof(packet2));
  6144. mavlink_msg_scaled_pressure3_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.press_abs , packet1.press_diff , packet1.temperature );
  6145. mavlink_msg_scaled_pressure3_decode(last_msg, &packet2);
  6146. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6147. }
  6148. static void mavlink_test_follow_target(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  6149. {
  6150. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  6151. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  6152. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_FOLLOW_TARGET >= 256) {
  6153. return;
  6154. }
  6155. #endif
  6156. mavlink_message_t msg;
  6157. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  6158. uint16_t i;
  6159. mavlink_follow_target_t packet_in = {
  6160. 93372036854775807ULL,93372036854776311ULL,963498296,963498504,185.0,{ 213.0, 214.0, 215.0 },{ 297.0, 298.0, 299.0 },{ 381.0, 382.0, 383.0, 384.0 },{ 493.0, 494.0, 495.0 },{ 577.0, 578.0, 579.0 },25
  6161. };
  6162. mavlink_follow_target_t packet1, packet2;
  6163. memset(&packet1, 0, sizeof(packet1));
  6164. packet1.timestamp = packet_in.timestamp;
  6165. packet1.custom_state = packet_in.custom_state;
  6166. packet1.lat = packet_in.lat;
  6167. packet1.lon = packet_in.lon;
  6168. packet1.alt = packet_in.alt;
  6169. packet1.est_capabilities = packet_in.est_capabilities;
  6170. mav_array_memcpy(packet1.vel, packet_in.vel, sizeof(float)*3);
  6171. mav_array_memcpy(packet1.acc, packet_in.acc, sizeof(float)*3);
  6172. mav_array_memcpy(packet1.attitude_q, packet_in.attitude_q, sizeof(float)*4);
  6173. mav_array_memcpy(packet1.rates, packet_in.rates, sizeof(float)*3);
  6174. mav_array_memcpy(packet1.position_cov, packet_in.position_cov, sizeof(float)*3);
  6175. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  6176. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  6177. // cope with extensions
  6178. memset(MAVLINK_MSG_ID_FOLLOW_TARGET_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_FOLLOW_TARGET_MIN_LEN);
  6179. }
  6180. #endif
  6181. memset(&packet2, 0, sizeof(packet2));
  6182. mavlink_msg_follow_target_encode(system_id, component_id, &msg, &packet1);
  6183. mavlink_msg_follow_target_decode(&msg, &packet2);
  6184. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6185. memset(&packet2, 0, sizeof(packet2));
  6186. mavlink_msg_follow_target_pack(system_id, component_id, &msg , packet1.timestamp , packet1.est_capabilities , packet1.lat , packet1.lon , packet1.alt , packet1.vel , packet1.acc , packet1.attitude_q , packet1.rates , packet1.position_cov , packet1.custom_state );
  6187. mavlink_msg_follow_target_decode(&msg, &packet2);
  6188. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6189. memset(&packet2, 0, sizeof(packet2));
  6190. mavlink_msg_follow_target_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.timestamp , packet1.est_capabilities , packet1.lat , packet1.lon , packet1.alt , packet1.vel , packet1.acc , packet1.attitude_q , packet1.rates , packet1.position_cov , packet1.custom_state );
  6191. mavlink_msg_follow_target_decode(&msg, &packet2);
  6192. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6193. memset(&packet2, 0, sizeof(packet2));
  6194. mavlink_msg_to_send_buffer(buffer, &msg);
  6195. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  6196. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  6197. }
  6198. mavlink_msg_follow_target_decode(last_msg, &packet2);
  6199. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6200. memset(&packet2, 0, sizeof(packet2));
  6201. mavlink_msg_follow_target_send(MAVLINK_COMM_1 , packet1.timestamp , packet1.est_capabilities , packet1.lat , packet1.lon , packet1.alt , packet1.vel , packet1.acc , packet1.attitude_q , packet1.rates , packet1.position_cov , packet1.custom_state );
  6202. mavlink_msg_follow_target_decode(last_msg, &packet2);
  6203. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6204. }
  6205. static void mavlink_test_control_system_state(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  6206. {
  6207. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  6208. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  6209. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE >= 256) {
  6210. return;
  6211. }
  6212. #endif
  6213. mavlink_message_t msg;
  6214. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  6215. uint16_t i;
  6216. mavlink_control_system_state_t packet_in = {
  6217. 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0,241.0,269.0,297.0,325.0,{ 353.0, 354.0, 355.0 },{ 437.0, 438.0, 439.0 },{ 521.0, 522.0, 523.0, 524.0 },633.0,661.0,689.0
  6218. };
  6219. mavlink_control_system_state_t packet1, packet2;
  6220. memset(&packet1, 0, sizeof(packet1));
  6221. packet1.time_usec = packet_in.time_usec;
  6222. packet1.x_acc = packet_in.x_acc;
  6223. packet1.y_acc = packet_in.y_acc;
  6224. packet1.z_acc = packet_in.z_acc;
  6225. packet1.x_vel = packet_in.x_vel;
  6226. packet1.y_vel = packet_in.y_vel;
  6227. packet1.z_vel = packet_in.z_vel;
  6228. packet1.x_pos = packet_in.x_pos;
  6229. packet1.y_pos = packet_in.y_pos;
  6230. packet1.z_pos = packet_in.z_pos;
  6231. packet1.airspeed = packet_in.airspeed;
  6232. packet1.roll_rate = packet_in.roll_rate;
  6233. packet1.pitch_rate = packet_in.pitch_rate;
  6234. packet1.yaw_rate = packet_in.yaw_rate;
  6235. mav_array_memcpy(packet1.vel_variance, packet_in.vel_variance, sizeof(float)*3);
  6236. mav_array_memcpy(packet1.pos_variance, packet_in.pos_variance, sizeof(float)*3);
  6237. mav_array_memcpy(packet1.q, packet_in.q, sizeof(float)*4);
  6238. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  6239. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  6240. // cope with extensions
  6241. memset(MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_MIN_LEN);
  6242. }
  6243. #endif
  6244. memset(&packet2, 0, sizeof(packet2));
  6245. mavlink_msg_control_system_state_encode(system_id, component_id, &msg, &packet1);
  6246. mavlink_msg_control_system_state_decode(&msg, &packet2);
  6247. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6248. memset(&packet2, 0, sizeof(packet2));
  6249. mavlink_msg_control_system_state_pack(system_id, component_id, &msg , packet1.time_usec , packet1.x_acc , packet1.y_acc , packet1.z_acc , packet1.x_vel , packet1.y_vel , packet1.z_vel , packet1.x_pos , packet1.y_pos , packet1.z_pos , packet1.airspeed , packet1.vel_variance , packet1.pos_variance , packet1.q , packet1.roll_rate , packet1.pitch_rate , packet1.yaw_rate );
  6250. mavlink_msg_control_system_state_decode(&msg, &packet2);
  6251. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6252. memset(&packet2, 0, sizeof(packet2));
  6253. mavlink_msg_control_system_state_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.x_acc , packet1.y_acc , packet1.z_acc , packet1.x_vel , packet1.y_vel , packet1.z_vel , packet1.x_pos , packet1.y_pos , packet1.z_pos , packet1.airspeed , packet1.vel_variance , packet1.pos_variance , packet1.q , packet1.roll_rate , packet1.pitch_rate , packet1.yaw_rate );
  6254. mavlink_msg_control_system_state_decode(&msg, &packet2);
  6255. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6256. memset(&packet2, 0, sizeof(packet2));
  6257. mavlink_msg_to_send_buffer(buffer, &msg);
  6258. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  6259. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  6260. }
  6261. mavlink_msg_control_system_state_decode(last_msg, &packet2);
  6262. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6263. memset(&packet2, 0, sizeof(packet2));
  6264. mavlink_msg_control_system_state_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.x_acc , packet1.y_acc , packet1.z_acc , packet1.x_vel , packet1.y_vel , packet1.z_vel , packet1.x_pos , packet1.y_pos , packet1.z_pos , packet1.airspeed , packet1.vel_variance , packet1.pos_variance , packet1.q , packet1.roll_rate , packet1.pitch_rate , packet1.yaw_rate );
  6265. mavlink_msg_control_system_state_decode(last_msg, &packet2);
  6266. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6267. }
  6268. static void mavlink_test_battery_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  6269. {
  6270. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  6271. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  6272. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_BATTERY_STATUS >= 256) {
  6273. return;
  6274. }
  6275. #endif
  6276. mavlink_message_t msg;
  6277. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  6278. uint16_t i;
  6279. mavlink_battery_status_t packet_in = {
  6280. 963497464,963497672,17651,{ 17755, 17756, 17757, 17758, 17759, 17760, 17761, 17762, 17763, 17764 },18795,101,168,235,46,963499336,125
  6281. };
  6282. mavlink_battery_status_t packet1, packet2;
  6283. memset(&packet1, 0, sizeof(packet1));
  6284. packet1.current_consumed = packet_in.current_consumed;
  6285. packet1.energy_consumed = packet_in.energy_consumed;
  6286. packet1.temperature = packet_in.temperature;
  6287. packet1.current_battery = packet_in.current_battery;
  6288. packet1.id = packet_in.id;
  6289. packet1.battery_function = packet_in.battery_function;
  6290. packet1.type = packet_in.type;
  6291. packet1.battery_remaining = packet_in.battery_remaining;
  6292. packet1.time_remaining = packet_in.time_remaining;
  6293. packet1.charge_state = packet_in.charge_state;
  6294. mav_array_memcpy(packet1.voltages, packet_in.voltages, sizeof(uint16_t)*10);
  6295. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  6296. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  6297. // cope with extensions
  6298. memset(MAVLINK_MSG_ID_BATTERY_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_BATTERY_STATUS_MIN_LEN);
  6299. }
  6300. #endif
  6301. memset(&packet2, 0, sizeof(packet2));
  6302. mavlink_msg_battery_status_encode(system_id, component_id, &msg, &packet1);
  6303. mavlink_msg_battery_status_decode(&msg, &packet2);
  6304. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6305. memset(&packet2, 0, sizeof(packet2));
  6306. mavlink_msg_battery_status_pack(system_id, component_id, &msg , packet1.id , packet1.battery_function , packet1.type , packet1.temperature , packet1.voltages , packet1.current_battery , packet1.current_consumed , packet1.energy_consumed , packet1.battery_remaining , packet1.time_remaining , packet1.charge_state );
  6307. mavlink_msg_battery_status_decode(&msg, &packet2);
  6308. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6309. memset(&packet2, 0, sizeof(packet2));
  6310. mavlink_msg_battery_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.id , packet1.battery_function , packet1.type , packet1.temperature , packet1.voltages , packet1.current_battery , packet1.current_consumed , packet1.energy_consumed , packet1.battery_remaining , packet1.time_remaining , packet1.charge_state );
  6311. mavlink_msg_battery_status_decode(&msg, &packet2);
  6312. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6313. memset(&packet2, 0, sizeof(packet2));
  6314. mavlink_msg_to_send_buffer(buffer, &msg);
  6315. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  6316. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  6317. }
  6318. mavlink_msg_battery_status_decode(last_msg, &packet2);
  6319. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6320. memset(&packet2, 0, sizeof(packet2));
  6321. mavlink_msg_battery_status_send(MAVLINK_COMM_1 , packet1.id , packet1.battery_function , packet1.type , packet1.temperature , packet1.voltages , packet1.current_battery , packet1.current_consumed , packet1.energy_consumed , packet1.battery_remaining , packet1.time_remaining , packet1.charge_state );
  6322. mavlink_msg_battery_status_decode(last_msg, &packet2);
  6323. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6324. }
  6325. static void mavlink_test_autopilot_version(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  6326. {
  6327. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  6328. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  6329. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_AUTOPILOT_VERSION >= 256) {
  6330. return;
  6331. }
  6332. #endif
  6333. mavlink_message_t msg;
  6334. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  6335. uint16_t i;
  6336. mavlink_autopilot_version_t packet_in = {
  6337. 93372036854775807ULL,93372036854776311ULL,963498296,963498504,963498712,963498920,18899,19003,{ 113, 114, 115, 116, 117, 118, 119, 120 },{ 137, 138, 139, 140, 141, 142, 143, 144 },{ 161, 162, 163, 164, 165, 166, 167, 168 },{ 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202 }
  6338. };
  6339. mavlink_autopilot_version_t packet1, packet2;
  6340. memset(&packet1, 0, sizeof(packet1));
  6341. packet1.capabilities = packet_in.capabilities;
  6342. packet1.uid = packet_in.uid;
  6343. packet1.flight_sw_version = packet_in.flight_sw_version;
  6344. packet1.middleware_sw_version = packet_in.middleware_sw_version;
  6345. packet1.os_sw_version = packet_in.os_sw_version;
  6346. packet1.board_version = packet_in.board_version;
  6347. packet1.vendor_id = packet_in.vendor_id;
  6348. packet1.product_id = packet_in.product_id;
  6349. mav_array_memcpy(packet1.flight_custom_version, packet_in.flight_custom_version, sizeof(uint8_t)*8);
  6350. mav_array_memcpy(packet1.middleware_custom_version, packet_in.middleware_custom_version, sizeof(uint8_t)*8);
  6351. mav_array_memcpy(packet1.os_custom_version, packet_in.os_custom_version, sizeof(uint8_t)*8);
  6352. mav_array_memcpy(packet1.uid2, packet_in.uid2, sizeof(uint8_t)*18);
  6353. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  6354. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  6355. // cope with extensions
  6356. memset(MAVLINK_MSG_ID_AUTOPILOT_VERSION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_AUTOPILOT_VERSION_MIN_LEN);
  6357. }
  6358. #endif
  6359. memset(&packet2, 0, sizeof(packet2));
  6360. mavlink_msg_autopilot_version_encode(system_id, component_id, &msg, &packet1);
  6361. mavlink_msg_autopilot_version_decode(&msg, &packet2);
  6362. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6363. memset(&packet2, 0, sizeof(packet2));
  6364. mavlink_msg_autopilot_version_pack(system_id, component_id, &msg , packet1.capabilities , packet1.flight_sw_version , packet1.middleware_sw_version , packet1.os_sw_version , packet1.board_version , packet1.flight_custom_version , packet1.middleware_custom_version , packet1.os_custom_version , packet1.vendor_id , packet1.product_id , packet1.uid , packet1.uid2 );
  6365. mavlink_msg_autopilot_version_decode(&msg, &packet2);
  6366. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6367. memset(&packet2, 0, sizeof(packet2));
  6368. mavlink_msg_autopilot_version_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.capabilities , packet1.flight_sw_version , packet1.middleware_sw_version , packet1.os_sw_version , packet1.board_version , packet1.flight_custom_version , packet1.middleware_custom_version , packet1.os_custom_version , packet1.vendor_id , packet1.product_id , packet1.uid , packet1.uid2 );
  6369. mavlink_msg_autopilot_version_decode(&msg, &packet2);
  6370. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6371. memset(&packet2, 0, sizeof(packet2));
  6372. mavlink_msg_to_send_buffer(buffer, &msg);
  6373. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  6374. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  6375. }
  6376. mavlink_msg_autopilot_version_decode(last_msg, &packet2);
  6377. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6378. memset(&packet2, 0, sizeof(packet2));
  6379. mavlink_msg_autopilot_version_send(MAVLINK_COMM_1 , packet1.capabilities , packet1.flight_sw_version , packet1.middleware_sw_version , packet1.os_sw_version , packet1.board_version , packet1.flight_custom_version , packet1.middleware_custom_version , packet1.os_custom_version , packet1.vendor_id , packet1.product_id , packet1.uid , packet1.uid2 );
  6380. mavlink_msg_autopilot_version_decode(last_msg, &packet2);
  6381. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6382. }
  6383. static void mavlink_test_landing_target(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  6384. {
  6385. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  6386. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  6387. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_LANDING_TARGET >= 256) {
  6388. return;
  6389. }
  6390. #endif
  6391. mavlink_message_t msg;
  6392. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  6393. uint16_t i;
  6394. mavlink_landing_target_t packet_in = {
  6395. 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,89,156,227.0,255.0,283.0,{ 311.0, 312.0, 313.0, 314.0 },51,118
  6396. };
  6397. mavlink_landing_target_t packet1, packet2;
  6398. memset(&packet1, 0, sizeof(packet1));
  6399. packet1.time_usec = packet_in.time_usec;
  6400. packet1.angle_x = packet_in.angle_x;
  6401. packet1.angle_y = packet_in.angle_y;
  6402. packet1.distance = packet_in.distance;
  6403. packet1.size_x = packet_in.size_x;
  6404. packet1.size_y = packet_in.size_y;
  6405. packet1.target_num = packet_in.target_num;
  6406. packet1.frame = packet_in.frame;
  6407. packet1.x = packet_in.x;
  6408. packet1.y = packet_in.y;
  6409. packet1.z = packet_in.z;
  6410. packet1.type = packet_in.type;
  6411. packet1.position_valid = packet_in.position_valid;
  6412. mav_array_memcpy(packet1.q, packet_in.q, sizeof(float)*4);
  6413. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  6414. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  6415. // cope with extensions
  6416. memset(MAVLINK_MSG_ID_LANDING_TARGET_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_LANDING_TARGET_MIN_LEN);
  6417. }
  6418. #endif
  6419. memset(&packet2, 0, sizeof(packet2));
  6420. mavlink_msg_landing_target_encode(system_id, component_id, &msg, &packet1);
  6421. mavlink_msg_landing_target_decode(&msg, &packet2);
  6422. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6423. memset(&packet2, 0, sizeof(packet2));
  6424. mavlink_msg_landing_target_pack(system_id, component_id, &msg , packet1.time_usec , packet1.target_num , packet1.frame , packet1.angle_x , packet1.angle_y , packet1.distance , packet1.size_x , packet1.size_y , packet1.x , packet1.y , packet1.z , packet1.q , packet1.type , packet1.position_valid );
  6425. mavlink_msg_landing_target_decode(&msg, &packet2);
  6426. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6427. memset(&packet2, 0, sizeof(packet2));
  6428. mavlink_msg_landing_target_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.target_num , packet1.frame , packet1.angle_x , packet1.angle_y , packet1.distance , packet1.size_x , packet1.size_y , packet1.x , packet1.y , packet1.z , packet1.q , packet1.type , packet1.position_valid );
  6429. mavlink_msg_landing_target_decode(&msg, &packet2);
  6430. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6431. memset(&packet2, 0, sizeof(packet2));
  6432. mavlink_msg_to_send_buffer(buffer, &msg);
  6433. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  6434. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  6435. }
  6436. mavlink_msg_landing_target_decode(last_msg, &packet2);
  6437. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6438. memset(&packet2, 0, sizeof(packet2));
  6439. mavlink_msg_landing_target_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.target_num , packet1.frame , packet1.angle_x , packet1.angle_y , packet1.distance , packet1.size_x , packet1.size_y , packet1.x , packet1.y , packet1.z , packet1.q , packet1.type , packet1.position_valid );
  6440. mavlink_msg_landing_target_decode(last_msg, &packet2);
  6441. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6442. }
  6443. static void mavlink_test_fence_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  6444. {
  6445. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  6446. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  6447. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_FENCE_STATUS >= 256) {
  6448. return;
  6449. }
  6450. #endif
  6451. mavlink_message_t msg;
  6452. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  6453. uint16_t i;
  6454. mavlink_fence_status_t packet_in = {
  6455. 963497464,17443,151,218,29
  6456. };
  6457. mavlink_fence_status_t packet1, packet2;
  6458. memset(&packet1, 0, sizeof(packet1));
  6459. packet1.breach_time = packet_in.breach_time;
  6460. packet1.breach_count = packet_in.breach_count;
  6461. packet1.breach_status = packet_in.breach_status;
  6462. packet1.breach_type = packet_in.breach_type;
  6463. packet1.breach_mitigation = packet_in.breach_mitigation;
  6464. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  6465. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  6466. // cope with extensions
  6467. memset(MAVLINK_MSG_ID_FENCE_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_FENCE_STATUS_MIN_LEN);
  6468. }
  6469. #endif
  6470. memset(&packet2, 0, sizeof(packet2));
  6471. mavlink_msg_fence_status_encode(system_id, component_id, &msg, &packet1);
  6472. mavlink_msg_fence_status_decode(&msg, &packet2);
  6473. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6474. memset(&packet2, 0, sizeof(packet2));
  6475. mavlink_msg_fence_status_pack(system_id, component_id, &msg , packet1.breach_status , packet1.breach_count , packet1.breach_type , packet1.breach_time , packet1.breach_mitigation );
  6476. mavlink_msg_fence_status_decode(&msg, &packet2);
  6477. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6478. memset(&packet2, 0, sizeof(packet2));
  6479. mavlink_msg_fence_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.breach_status , packet1.breach_count , packet1.breach_type , packet1.breach_time , packet1.breach_mitigation );
  6480. mavlink_msg_fence_status_decode(&msg, &packet2);
  6481. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6482. memset(&packet2, 0, sizeof(packet2));
  6483. mavlink_msg_to_send_buffer(buffer, &msg);
  6484. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  6485. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  6486. }
  6487. mavlink_msg_fence_status_decode(last_msg, &packet2);
  6488. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6489. memset(&packet2, 0, sizeof(packet2));
  6490. mavlink_msg_fence_status_send(MAVLINK_COMM_1 , packet1.breach_status , packet1.breach_count , packet1.breach_type , packet1.breach_time , packet1.breach_mitigation );
  6491. mavlink_msg_fence_status_decode(last_msg, &packet2);
  6492. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6493. }
  6494. static void mavlink_test_estimator_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  6495. {
  6496. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  6497. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  6498. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ESTIMATOR_STATUS >= 256) {
  6499. return;
  6500. }
  6501. #endif
  6502. mavlink_message_t msg;
  6503. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  6504. uint16_t i;
  6505. mavlink_estimator_status_t packet_in = {
  6506. 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0,241.0,269.0,19315
  6507. };
  6508. mavlink_estimator_status_t packet1, packet2;
  6509. memset(&packet1, 0, sizeof(packet1));
  6510. packet1.time_usec = packet_in.time_usec;
  6511. packet1.vel_ratio = packet_in.vel_ratio;
  6512. packet1.pos_horiz_ratio = packet_in.pos_horiz_ratio;
  6513. packet1.pos_vert_ratio = packet_in.pos_vert_ratio;
  6514. packet1.mag_ratio = packet_in.mag_ratio;
  6515. packet1.hagl_ratio = packet_in.hagl_ratio;
  6516. packet1.tas_ratio = packet_in.tas_ratio;
  6517. packet1.pos_horiz_accuracy = packet_in.pos_horiz_accuracy;
  6518. packet1.pos_vert_accuracy = packet_in.pos_vert_accuracy;
  6519. packet1.flags = packet_in.flags;
  6520. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  6521. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  6522. // cope with extensions
  6523. memset(MAVLINK_MSG_ID_ESTIMATOR_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ESTIMATOR_STATUS_MIN_LEN);
  6524. }
  6525. #endif
  6526. memset(&packet2, 0, sizeof(packet2));
  6527. mavlink_msg_estimator_status_encode(system_id, component_id, &msg, &packet1);
  6528. mavlink_msg_estimator_status_decode(&msg, &packet2);
  6529. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6530. memset(&packet2, 0, sizeof(packet2));
  6531. mavlink_msg_estimator_status_pack(system_id, component_id, &msg , packet1.time_usec , packet1.flags , packet1.vel_ratio , packet1.pos_horiz_ratio , packet1.pos_vert_ratio , packet1.mag_ratio , packet1.hagl_ratio , packet1.tas_ratio , packet1.pos_horiz_accuracy , packet1.pos_vert_accuracy );
  6532. mavlink_msg_estimator_status_decode(&msg, &packet2);
  6533. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6534. memset(&packet2, 0, sizeof(packet2));
  6535. mavlink_msg_estimator_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.flags , packet1.vel_ratio , packet1.pos_horiz_ratio , packet1.pos_vert_ratio , packet1.mag_ratio , packet1.hagl_ratio , packet1.tas_ratio , packet1.pos_horiz_accuracy , packet1.pos_vert_accuracy );
  6536. mavlink_msg_estimator_status_decode(&msg, &packet2);
  6537. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6538. memset(&packet2, 0, sizeof(packet2));
  6539. mavlink_msg_to_send_buffer(buffer, &msg);
  6540. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  6541. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  6542. }
  6543. mavlink_msg_estimator_status_decode(last_msg, &packet2);
  6544. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6545. memset(&packet2, 0, sizeof(packet2));
  6546. mavlink_msg_estimator_status_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.flags , packet1.vel_ratio , packet1.pos_horiz_ratio , packet1.pos_vert_ratio , packet1.mag_ratio , packet1.hagl_ratio , packet1.tas_ratio , packet1.pos_horiz_accuracy , packet1.pos_vert_accuracy );
  6547. mavlink_msg_estimator_status_decode(last_msg, &packet2);
  6548. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6549. }
  6550. static void mavlink_test_wind_cov(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  6551. {
  6552. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  6553. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  6554. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_WIND_COV >= 256) {
  6555. return;
  6556. }
  6557. #endif
  6558. mavlink_message_t msg;
  6559. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  6560. uint16_t i;
  6561. mavlink_wind_cov_t packet_in = {
  6562. 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0,241.0,269.0
  6563. };
  6564. mavlink_wind_cov_t packet1, packet2;
  6565. memset(&packet1, 0, sizeof(packet1));
  6566. packet1.time_usec = packet_in.time_usec;
  6567. packet1.wind_x = packet_in.wind_x;
  6568. packet1.wind_y = packet_in.wind_y;
  6569. packet1.wind_z = packet_in.wind_z;
  6570. packet1.var_horiz = packet_in.var_horiz;
  6571. packet1.var_vert = packet_in.var_vert;
  6572. packet1.wind_alt = packet_in.wind_alt;
  6573. packet1.horiz_accuracy = packet_in.horiz_accuracy;
  6574. packet1.vert_accuracy = packet_in.vert_accuracy;
  6575. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  6576. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  6577. // cope with extensions
  6578. memset(MAVLINK_MSG_ID_WIND_COV_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_WIND_COV_MIN_LEN);
  6579. }
  6580. #endif
  6581. memset(&packet2, 0, sizeof(packet2));
  6582. mavlink_msg_wind_cov_encode(system_id, component_id, &msg, &packet1);
  6583. mavlink_msg_wind_cov_decode(&msg, &packet2);
  6584. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6585. memset(&packet2, 0, sizeof(packet2));
  6586. mavlink_msg_wind_cov_pack(system_id, component_id, &msg , packet1.time_usec , packet1.wind_x , packet1.wind_y , packet1.wind_z , packet1.var_horiz , packet1.var_vert , packet1.wind_alt , packet1.horiz_accuracy , packet1.vert_accuracy );
  6587. mavlink_msg_wind_cov_decode(&msg, &packet2);
  6588. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6589. memset(&packet2, 0, sizeof(packet2));
  6590. mavlink_msg_wind_cov_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.wind_x , packet1.wind_y , packet1.wind_z , packet1.var_horiz , packet1.var_vert , packet1.wind_alt , packet1.horiz_accuracy , packet1.vert_accuracy );
  6591. mavlink_msg_wind_cov_decode(&msg, &packet2);
  6592. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6593. memset(&packet2, 0, sizeof(packet2));
  6594. mavlink_msg_to_send_buffer(buffer, &msg);
  6595. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  6596. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  6597. }
  6598. mavlink_msg_wind_cov_decode(last_msg, &packet2);
  6599. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6600. memset(&packet2, 0, sizeof(packet2));
  6601. mavlink_msg_wind_cov_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.wind_x , packet1.wind_y , packet1.wind_z , packet1.var_horiz , packet1.var_vert , packet1.wind_alt , packet1.horiz_accuracy , packet1.vert_accuracy );
  6602. mavlink_msg_wind_cov_decode(last_msg, &packet2);
  6603. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6604. }
  6605. static void mavlink_test_gps_input(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  6606. {
  6607. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  6608. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  6609. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GPS_INPUT >= 256) {
  6610. return;
  6611. }
  6612. #endif
  6613. mavlink_message_t msg;
  6614. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  6615. uint16_t i;
  6616. mavlink_gps_input_t packet_in = {
  6617. 93372036854775807ULL,963497880,963498088,963498296,157.0,185.0,213.0,241.0,269.0,297.0,325.0,353.0,381.0,20147,20251,185,252,63,20511
  6618. };
  6619. mavlink_gps_input_t packet1, packet2;
  6620. memset(&packet1, 0, sizeof(packet1));
  6621. packet1.time_usec = packet_in.time_usec;
  6622. packet1.time_week_ms = packet_in.time_week_ms;
  6623. packet1.lat = packet_in.lat;
  6624. packet1.lon = packet_in.lon;
  6625. packet1.alt = packet_in.alt;
  6626. packet1.hdop = packet_in.hdop;
  6627. packet1.vdop = packet_in.vdop;
  6628. packet1.vn = packet_in.vn;
  6629. packet1.ve = packet_in.ve;
  6630. packet1.vd = packet_in.vd;
  6631. packet1.speed_accuracy = packet_in.speed_accuracy;
  6632. packet1.horiz_accuracy = packet_in.horiz_accuracy;
  6633. packet1.vert_accuracy = packet_in.vert_accuracy;
  6634. packet1.ignore_flags = packet_in.ignore_flags;
  6635. packet1.time_week = packet_in.time_week;
  6636. packet1.gps_id = packet_in.gps_id;
  6637. packet1.fix_type = packet_in.fix_type;
  6638. packet1.satellites_visible = packet_in.satellites_visible;
  6639. packet1.yaw = packet_in.yaw;
  6640. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  6641. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  6642. // cope with extensions
  6643. memset(MAVLINK_MSG_ID_GPS_INPUT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GPS_INPUT_MIN_LEN);
  6644. }
  6645. #endif
  6646. memset(&packet2, 0, sizeof(packet2));
  6647. mavlink_msg_gps_input_encode(system_id, component_id, &msg, &packet1);
  6648. mavlink_msg_gps_input_decode(&msg, &packet2);
  6649. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6650. memset(&packet2, 0, sizeof(packet2));
  6651. mavlink_msg_gps_input_pack(system_id, component_id, &msg , packet1.time_usec , packet1.gps_id , packet1.ignore_flags , packet1.time_week_ms , packet1.time_week , packet1.fix_type , packet1.lat , packet1.lon , packet1.alt , packet1.hdop , packet1.vdop , packet1.vn , packet1.ve , packet1.vd , packet1.speed_accuracy , packet1.horiz_accuracy , packet1.vert_accuracy , packet1.satellites_visible , packet1.yaw );
  6652. mavlink_msg_gps_input_decode(&msg, &packet2);
  6653. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6654. memset(&packet2, 0, sizeof(packet2));
  6655. mavlink_msg_gps_input_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.gps_id , packet1.ignore_flags , packet1.time_week_ms , packet1.time_week , packet1.fix_type , packet1.lat , packet1.lon , packet1.alt , packet1.hdop , packet1.vdop , packet1.vn , packet1.ve , packet1.vd , packet1.speed_accuracy , packet1.horiz_accuracy , packet1.vert_accuracy , packet1.satellites_visible , packet1.yaw );
  6656. mavlink_msg_gps_input_decode(&msg, &packet2);
  6657. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6658. memset(&packet2, 0, sizeof(packet2));
  6659. mavlink_msg_to_send_buffer(buffer, &msg);
  6660. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  6661. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  6662. }
  6663. mavlink_msg_gps_input_decode(last_msg, &packet2);
  6664. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6665. memset(&packet2, 0, sizeof(packet2));
  6666. mavlink_msg_gps_input_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.gps_id , packet1.ignore_flags , packet1.time_week_ms , packet1.time_week , packet1.fix_type , packet1.lat , packet1.lon , packet1.alt , packet1.hdop , packet1.vdop , packet1.vn , packet1.ve , packet1.vd , packet1.speed_accuracy , packet1.horiz_accuracy , packet1.vert_accuracy , packet1.satellites_visible , packet1.yaw );
  6667. mavlink_msg_gps_input_decode(last_msg, &packet2);
  6668. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6669. }
  6670. static void mavlink_test_gps_rtcm_data(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  6671. {
  6672. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  6673. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  6674. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GPS_RTCM_DATA >= 256) {
  6675. return;
  6676. }
  6677. #endif
  6678. mavlink_message_t msg;
  6679. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  6680. uint16_t i;
  6681. mavlink_gps_rtcm_data_t packet_in = {
  6682. 5,72,{ 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62 }
  6683. };
  6684. mavlink_gps_rtcm_data_t packet1, packet2;
  6685. memset(&packet1, 0, sizeof(packet1));
  6686. packet1.flags = packet_in.flags;
  6687. packet1.len = packet_in.len;
  6688. mav_array_memcpy(packet1.data, packet_in.data, sizeof(uint8_t)*180);
  6689. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  6690. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  6691. // cope with extensions
  6692. memset(MAVLINK_MSG_ID_GPS_RTCM_DATA_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GPS_RTCM_DATA_MIN_LEN);
  6693. }
  6694. #endif
  6695. memset(&packet2, 0, sizeof(packet2));
  6696. mavlink_msg_gps_rtcm_data_encode(system_id, component_id, &msg, &packet1);
  6697. mavlink_msg_gps_rtcm_data_decode(&msg, &packet2);
  6698. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6699. memset(&packet2, 0, sizeof(packet2));
  6700. mavlink_msg_gps_rtcm_data_pack(system_id, component_id, &msg , packet1.flags , packet1.len , packet1.data );
  6701. mavlink_msg_gps_rtcm_data_decode(&msg, &packet2);
  6702. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6703. memset(&packet2, 0, sizeof(packet2));
  6704. mavlink_msg_gps_rtcm_data_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.flags , packet1.len , packet1.data );
  6705. mavlink_msg_gps_rtcm_data_decode(&msg, &packet2);
  6706. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6707. memset(&packet2, 0, sizeof(packet2));
  6708. mavlink_msg_to_send_buffer(buffer, &msg);
  6709. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  6710. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  6711. }
  6712. mavlink_msg_gps_rtcm_data_decode(last_msg, &packet2);
  6713. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6714. memset(&packet2, 0, sizeof(packet2));
  6715. mavlink_msg_gps_rtcm_data_send(MAVLINK_COMM_1 , packet1.flags , packet1.len , packet1.data );
  6716. mavlink_msg_gps_rtcm_data_decode(last_msg, &packet2);
  6717. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6718. }
  6719. static void mavlink_test_high_latency(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  6720. {
  6721. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  6722. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  6723. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_HIGH_LATENCY >= 256) {
  6724. return;
  6725. }
  6726. #endif
  6727. mavlink_message_t msg;
  6728. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  6729. uint16_t i;
  6730. mavlink_high_latency_t packet_in = {
  6731. 963497464,963497672,963497880,17859,17963,18067,18171,18275,18379,18483,211,22,89,156,223,34,101,168,235,46,113,180,247,58
  6732. };
  6733. mavlink_high_latency_t packet1, packet2;
  6734. memset(&packet1, 0, sizeof(packet1));
  6735. packet1.custom_mode = packet_in.custom_mode;
  6736. packet1.latitude = packet_in.latitude;
  6737. packet1.longitude = packet_in.longitude;
  6738. packet1.roll = packet_in.roll;
  6739. packet1.pitch = packet_in.pitch;
  6740. packet1.heading = packet_in.heading;
  6741. packet1.heading_sp = packet_in.heading_sp;
  6742. packet1.altitude_amsl = packet_in.altitude_amsl;
  6743. packet1.altitude_sp = packet_in.altitude_sp;
  6744. packet1.wp_distance = packet_in.wp_distance;
  6745. packet1.base_mode = packet_in.base_mode;
  6746. packet1.landed_state = packet_in.landed_state;
  6747. packet1.throttle = packet_in.throttle;
  6748. packet1.airspeed = packet_in.airspeed;
  6749. packet1.airspeed_sp = packet_in.airspeed_sp;
  6750. packet1.groundspeed = packet_in.groundspeed;
  6751. packet1.climb_rate = packet_in.climb_rate;
  6752. packet1.gps_nsat = packet_in.gps_nsat;
  6753. packet1.gps_fix_type = packet_in.gps_fix_type;
  6754. packet1.battery_remaining = packet_in.battery_remaining;
  6755. packet1.temperature = packet_in.temperature;
  6756. packet1.temperature_air = packet_in.temperature_air;
  6757. packet1.failsafe = packet_in.failsafe;
  6758. packet1.wp_num = packet_in.wp_num;
  6759. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  6760. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  6761. // cope with extensions
  6762. memset(MAVLINK_MSG_ID_HIGH_LATENCY_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_HIGH_LATENCY_MIN_LEN);
  6763. }
  6764. #endif
  6765. memset(&packet2, 0, sizeof(packet2));
  6766. mavlink_msg_high_latency_encode(system_id, component_id, &msg, &packet1);
  6767. mavlink_msg_high_latency_decode(&msg, &packet2);
  6768. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6769. memset(&packet2, 0, sizeof(packet2));
  6770. mavlink_msg_high_latency_pack(system_id, component_id, &msg , packet1.base_mode , packet1.custom_mode , packet1.landed_state , packet1.roll , packet1.pitch , packet1.heading , packet1.throttle , packet1.heading_sp , packet1.latitude , packet1.longitude , packet1.altitude_amsl , packet1.altitude_sp , packet1.airspeed , packet1.airspeed_sp , packet1.groundspeed , packet1.climb_rate , packet1.gps_nsat , packet1.gps_fix_type , packet1.battery_remaining , packet1.temperature , packet1.temperature_air , packet1.failsafe , packet1.wp_num , packet1.wp_distance );
  6771. mavlink_msg_high_latency_decode(&msg, &packet2);
  6772. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6773. memset(&packet2, 0, sizeof(packet2));
  6774. mavlink_msg_high_latency_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.base_mode , packet1.custom_mode , packet1.landed_state , packet1.roll , packet1.pitch , packet1.heading , packet1.throttle , packet1.heading_sp , packet1.latitude , packet1.longitude , packet1.altitude_amsl , packet1.altitude_sp , packet1.airspeed , packet1.airspeed_sp , packet1.groundspeed , packet1.climb_rate , packet1.gps_nsat , packet1.gps_fix_type , packet1.battery_remaining , packet1.temperature , packet1.temperature_air , packet1.failsafe , packet1.wp_num , packet1.wp_distance );
  6775. mavlink_msg_high_latency_decode(&msg, &packet2);
  6776. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6777. memset(&packet2, 0, sizeof(packet2));
  6778. mavlink_msg_to_send_buffer(buffer, &msg);
  6779. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  6780. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  6781. }
  6782. mavlink_msg_high_latency_decode(last_msg, &packet2);
  6783. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6784. memset(&packet2, 0, sizeof(packet2));
  6785. mavlink_msg_high_latency_send(MAVLINK_COMM_1 , packet1.base_mode , packet1.custom_mode , packet1.landed_state , packet1.roll , packet1.pitch , packet1.heading , packet1.throttle , packet1.heading_sp , packet1.latitude , packet1.longitude , packet1.altitude_amsl , packet1.altitude_sp , packet1.airspeed , packet1.airspeed_sp , packet1.groundspeed , packet1.climb_rate , packet1.gps_nsat , packet1.gps_fix_type , packet1.battery_remaining , packet1.temperature , packet1.temperature_air , packet1.failsafe , packet1.wp_num , packet1.wp_distance );
  6786. mavlink_msg_high_latency_decode(last_msg, &packet2);
  6787. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6788. }
  6789. static void mavlink_test_high_latency2(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  6790. {
  6791. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  6792. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  6793. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_HIGH_LATENCY2 >= 256) {
  6794. return;
  6795. }
  6796. #endif
  6797. mavlink_message_t msg;
  6798. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  6799. uint16_t i;
  6800. mavlink_high_latency2_t packet_in = {
  6801. 963497464,963497672,963497880,17859,17963,18067,18171,18275,18379,77,144,211,22,89,156,223,34,101,168,235,46,113,180,247,58,125,192
  6802. };
  6803. mavlink_high_latency2_t packet1, packet2;
  6804. memset(&packet1, 0, sizeof(packet1));
  6805. packet1.timestamp = packet_in.timestamp;
  6806. packet1.latitude = packet_in.latitude;
  6807. packet1.longitude = packet_in.longitude;
  6808. packet1.custom_mode = packet_in.custom_mode;
  6809. packet1.altitude = packet_in.altitude;
  6810. packet1.target_altitude = packet_in.target_altitude;
  6811. packet1.target_distance = packet_in.target_distance;
  6812. packet1.wp_num = packet_in.wp_num;
  6813. packet1.failure_flags = packet_in.failure_flags;
  6814. packet1.type = packet_in.type;
  6815. packet1.autopilot = packet_in.autopilot;
  6816. packet1.heading = packet_in.heading;
  6817. packet1.target_heading = packet_in.target_heading;
  6818. packet1.throttle = packet_in.throttle;
  6819. packet1.airspeed = packet_in.airspeed;
  6820. packet1.airspeed_sp = packet_in.airspeed_sp;
  6821. packet1.groundspeed = packet_in.groundspeed;
  6822. packet1.windspeed = packet_in.windspeed;
  6823. packet1.wind_heading = packet_in.wind_heading;
  6824. packet1.eph = packet_in.eph;
  6825. packet1.epv = packet_in.epv;
  6826. packet1.temperature_air = packet_in.temperature_air;
  6827. packet1.climb_rate = packet_in.climb_rate;
  6828. packet1.battery = packet_in.battery;
  6829. packet1.custom0 = packet_in.custom0;
  6830. packet1.custom1 = packet_in.custom1;
  6831. packet1.custom2 = packet_in.custom2;
  6832. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  6833. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  6834. // cope with extensions
  6835. memset(MAVLINK_MSG_ID_HIGH_LATENCY2_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_HIGH_LATENCY2_MIN_LEN);
  6836. }
  6837. #endif
  6838. memset(&packet2, 0, sizeof(packet2));
  6839. mavlink_msg_high_latency2_encode(system_id, component_id, &msg, &packet1);
  6840. mavlink_msg_high_latency2_decode(&msg, &packet2);
  6841. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6842. memset(&packet2, 0, sizeof(packet2));
  6843. mavlink_msg_high_latency2_pack(system_id, component_id, &msg , packet1.timestamp , packet1.type , packet1.autopilot , packet1.custom_mode , packet1.latitude , packet1.longitude , packet1.altitude , packet1.target_altitude , packet1.heading , packet1.target_heading , packet1.target_distance , packet1.throttle , packet1.airspeed , packet1.airspeed_sp , packet1.groundspeed , packet1.windspeed , packet1.wind_heading , packet1.eph , packet1.epv , packet1.temperature_air , packet1.climb_rate , packet1.battery , packet1.wp_num , packet1.failure_flags , packet1.custom0 , packet1.custom1 , packet1.custom2 );
  6844. mavlink_msg_high_latency2_decode(&msg, &packet2);
  6845. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6846. memset(&packet2, 0, sizeof(packet2));
  6847. mavlink_msg_high_latency2_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.timestamp , packet1.type , packet1.autopilot , packet1.custom_mode , packet1.latitude , packet1.longitude , packet1.altitude , packet1.target_altitude , packet1.heading , packet1.target_heading , packet1.target_distance , packet1.throttle , packet1.airspeed , packet1.airspeed_sp , packet1.groundspeed , packet1.windspeed , packet1.wind_heading , packet1.eph , packet1.epv , packet1.temperature_air , packet1.climb_rate , packet1.battery , packet1.wp_num , packet1.failure_flags , packet1.custom0 , packet1.custom1 , packet1.custom2 );
  6848. mavlink_msg_high_latency2_decode(&msg, &packet2);
  6849. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6850. memset(&packet2, 0, sizeof(packet2));
  6851. mavlink_msg_to_send_buffer(buffer, &msg);
  6852. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  6853. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  6854. }
  6855. mavlink_msg_high_latency2_decode(last_msg, &packet2);
  6856. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6857. memset(&packet2, 0, sizeof(packet2));
  6858. mavlink_msg_high_latency2_send(MAVLINK_COMM_1 , packet1.timestamp , packet1.type , packet1.autopilot , packet1.custom_mode , packet1.latitude , packet1.longitude , packet1.altitude , packet1.target_altitude , packet1.heading , packet1.target_heading , packet1.target_distance , packet1.throttle , packet1.airspeed , packet1.airspeed_sp , packet1.groundspeed , packet1.windspeed , packet1.wind_heading , packet1.eph , packet1.epv , packet1.temperature_air , packet1.climb_rate , packet1.battery , packet1.wp_num , packet1.failure_flags , packet1.custom0 , packet1.custom1 , packet1.custom2 );
  6859. mavlink_msg_high_latency2_decode(last_msg, &packet2);
  6860. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6861. }
  6862. static void mavlink_test_vibration(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  6863. {
  6864. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  6865. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  6866. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_VIBRATION >= 256) {
  6867. return;
  6868. }
  6869. #endif
  6870. mavlink_message_t msg;
  6871. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  6872. uint16_t i;
  6873. mavlink_vibration_t packet_in = {
  6874. 93372036854775807ULL,73.0,101.0,129.0,963498504,963498712,963498920
  6875. };
  6876. mavlink_vibration_t packet1, packet2;
  6877. memset(&packet1, 0, sizeof(packet1));
  6878. packet1.time_usec = packet_in.time_usec;
  6879. packet1.vibration_x = packet_in.vibration_x;
  6880. packet1.vibration_y = packet_in.vibration_y;
  6881. packet1.vibration_z = packet_in.vibration_z;
  6882. packet1.clipping_0 = packet_in.clipping_0;
  6883. packet1.clipping_1 = packet_in.clipping_1;
  6884. packet1.clipping_2 = packet_in.clipping_2;
  6885. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  6886. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  6887. // cope with extensions
  6888. memset(MAVLINK_MSG_ID_VIBRATION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_VIBRATION_MIN_LEN);
  6889. }
  6890. #endif
  6891. memset(&packet2, 0, sizeof(packet2));
  6892. mavlink_msg_vibration_encode(system_id, component_id, &msg, &packet1);
  6893. mavlink_msg_vibration_decode(&msg, &packet2);
  6894. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6895. memset(&packet2, 0, sizeof(packet2));
  6896. mavlink_msg_vibration_pack(system_id, component_id, &msg , packet1.time_usec , packet1.vibration_x , packet1.vibration_y , packet1.vibration_z , packet1.clipping_0 , packet1.clipping_1 , packet1.clipping_2 );
  6897. mavlink_msg_vibration_decode(&msg, &packet2);
  6898. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6899. memset(&packet2, 0, sizeof(packet2));
  6900. mavlink_msg_vibration_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.vibration_x , packet1.vibration_y , packet1.vibration_z , packet1.clipping_0 , packet1.clipping_1 , packet1.clipping_2 );
  6901. mavlink_msg_vibration_decode(&msg, &packet2);
  6902. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6903. memset(&packet2, 0, sizeof(packet2));
  6904. mavlink_msg_to_send_buffer(buffer, &msg);
  6905. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  6906. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  6907. }
  6908. mavlink_msg_vibration_decode(last_msg, &packet2);
  6909. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6910. memset(&packet2, 0, sizeof(packet2));
  6911. mavlink_msg_vibration_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.vibration_x , packet1.vibration_y , packet1.vibration_z , packet1.clipping_0 , packet1.clipping_1 , packet1.clipping_2 );
  6912. mavlink_msg_vibration_decode(last_msg, &packet2);
  6913. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6914. }
  6915. static void mavlink_test_home_position(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  6916. {
  6917. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  6918. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  6919. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_HOME_POSITION >= 256) {
  6920. return;
  6921. }
  6922. #endif
  6923. mavlink_message_t msg;
  6924. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  6925. uint16_t i;
  6926. mavlink_home_position_t packet_in = {
  6927. 963497464,963497672,963497880,101.0,129.0,157.0,{ 185.0, 186.0, 187.0, 188.0 },297.0,325.0,353.0,93372036854779083ULL
  6928. };
  6929. mavlink_home_position_t packet1, packet2;
  6930. memset(&packet1, 0, sizeof(packet1));
  6931. packet1.latitude = packet_in.latitude;
  6932. packet1.longitude = packet_in.longitude;
  6933. packet1.altitude = packet_in.altitude;
  6934. packet1.x = packet_in.x;
  6935. packet1.y = packet_in.y;
  6936. packet1.z = packet_in.z;
  6937. packet1.approach_x = packet_in.approach_x;
  6938. packet1.approach_y = packet_in.approach_y;
  6939. packet1.approach_z = packet_in.approach_z;
  6940. packet1.time_usec = packet_in.time_usec;
  6941. mav_array_memcpy(packet1.q, packet_in.q, sizeof(float)*4);
  6942. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  6943. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  6944. // cope with extensions
  6945. memset(MAVLINK_MSG_ID_HOME_POSITION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_HOME_POSITION_MIN_LEN);
  6946. }
  6947. #endif
  6948. memset(&packet2, 0, sizeof(packet2));
  6949. mavlink_msg_home_position_encode(system_id, component_id, &msg, &packet1);
  6950. mavlink_msg_home_position_decode(&msg, &packet2);
  6951. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6952. memset(&packet2, 0, sizeof(packet2));
  6953. mavlink_msg_home_position_pack(system_id, component_id, &msg , packet1.latitude , packet1.longitude , packet1.altitude , packet1.x , packet1.y , packet1.z , packet1.q , packet1.approach_x , packet1.approach_y , packet1.approach_z , packet1.time_usec );
  6954. mavlink_msg_home_position_decode(&msg, &packet2);
  6955. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6956. memset(&packet2, 0, sizeof(packet2));
  6957. mavlink_msg_home_position_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.latitude , packet1.longitude , packet1.altitude , packet1.x , packet1.y , packet1.z , packet1.q , packet1.approach_x , packet1.approach_y , packet1.approach_z , packet1.time_usec );
  6958. mavlink_msg_home_position_decode(&msg, &packet2);
  6959. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6960. memset(&packet2, 0, sizeof(packet2));
  6961. mavlink_msg_to_send_buffer(buffer, &msg);
  6962. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  6963. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  6964. }
  6965. mavlink_msg_home_position_decode(last_msg, &packet2);
  6966. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6967. memset(&packet2, 0, sizeof(packet2));
  6968. mavlink_msg_home_position_send(MAVLINK_COMM_1 , packet1.latitude , packet1.longitude , packet1.altitude , packet1.x , packet1.y , packet1.z , packet1.q , packet1.approach_x , packet1.approach_y , packet1.approach_z , packet1.time_usec );
  6969. mavlink_msg_home_position_decode(last_msg, &packet2);
  6970. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  6971. }
  6972. static void mavlink_test_set_home_position(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  6973. {
  6974. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  6975. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  6976. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SET_HOME_POSITION >= 256) {
  6977. return;
  6978. }
  6979. #endif
  6980. mavlink_message_t msg;
  6981. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  6982. uint16_t i;
  6983. mavlink_set_home_position_t packet_in = {
  6984. 963497464,963497672,963497880,101.0,129.0,157.0,{ 185.0, 186.0, 187.0, 188.0 },297.0,325.0,353.0,161,93372036854779146ULL
  6985. };
  6986. mavlink_set_home_position_t packet1, packet2;
  6987. memset(&packet1, 0, sizeof(packet1));
  6988. packet1.latitude = packet_in.latitude;
  6989. packet1.longitude = packet_in.longitude;
  6990. packet1.altitude = packet_in.altitude;
  6991. packet1.x = packet_in.x;
  6992. packet1.y = packet_in.y;
  6993. packet1.z = packet_in.z;
  6994. packet1.approach_x = packet_in.approach_x;
  6995. packet1.approach_y = packet_in.approach_y;
  6996. packet1.approach_z = packet_in.approach_z;
  6997. packet1.target_system = packet_in.target_system;
  6998. packet1.time_usec = packet_in.time_usec;
  6999. mav_array_memcpy(packet1.q, packet_in.q, sizeof(float)*4);
  7000. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7001. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  7002. // cope with extensions
  7003. memset(MAVLINK_MSG_ID_SET_HOME_POSITION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SET_HOME_POSITION_MIN_LEN);
  7004. }
  7005. #endif
  7006. memset(&packet2, 0, sizeof(packet2));
  7007. mavlink_msg_set_home_position_encode(system_id, component_id, &msg, &packet1);
  7008. mavlink_msg_set_home_position_decode(&msg, &packet2);
  7009. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7010. memset(&packet2, 0, sizeof(packet2));
  7011. mavlink_msg_set_home_position_pack(system_id, component_id, &msg , packet1.target_system , packet1.latitude , packet1.longitude , packet1.altitude , packet1.x , packet1.y , packet1.z , packet1.q , packet1.approach_x , packet1.approach_y , packet1.approach_z , packet1.time_usec );
  7012. mavlink_msg_set_home_position_decode(&msg, &packet2);
  7013. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7014. memset(&packet2, 0, sizeof(packet2));
  7015. mavlink_msg_set_home_position_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.latitude , packet1.longitude , packet1.altitude , packet1.x , packet1.y , packet1.z , packet1.q , packet1.approach_x , packet1.approach_y , packet1.approach_z , packet1.time_usec );
  7016. mavlink_msg_set_home_position_decode(&msg, &packet2);
  7017. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7018. memset(&packet2, 0, sizeof(packet2));
  7019. mavlink_msg_to_send_buffer(buffer, &msg);
  7020. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  7021. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  7022. }
  7023. mavlink_msg_set_home_position_decode(last_msg, &packet2);
  7024. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7025. memset(&packet2, 0, sizeof(packet2));
  7026. mavlink_msg_set_home_position_send(MAVLINK_COMM_1 , packet1.target_system , packet1.latitude , packet1.longitude , packet1.altitude , packet1.x , packet1.y , packet1.z , packet1.q , packet1.approach_x , packet1.approach_y , packet1.approach_z , packet1.time_usec );
  7027. mavlink_msg_set_home_position_decode(last_msg, &packet2);
  7028. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7029. }
  7030. static void mavlink_test_message_interval(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  7031. {
  7032. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7033. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  7034. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MESSAGE_INTERVAL >= 256) {
  7035. return;
  7036. }
  7037. #endif
  7038. mavlink_message_t msg;
  7039. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  7040. uint16_t i;
  7041. mavlink_message_interval_t packet_in = {
  7042. 963497464,17443
  7043. };
  7044. mavlink_message_interval_t packet1, packet2;
  7045. memset(&packet1, 0, sizeof(packet1));
  7046. packet1.interval_us = packet_in.interval_us;
  7047. packet1.message_id = packet_in.message_id;
  7048. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7049. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  7050. // cope with extensions
  7051. memset(MAVLINK_MSG_ID_MESSAGE_INTERVAL_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MESSAGE_INTERVAL_MIN_LEN);
  7052. }
  7053. #endif
  7054. memset(&packet2, 0, sizeof(packet2));
  7055. mavlink_msg_message_interval_encode(system_id, component_id, &msg, &packet1);
  7056. mavlink_msg_message_interval_decode(&msg, &packet2);
  7057. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7058. memset(&packet2, 0, sizeof(packet2));
  7059. mavlink_msg_message_interval_pack(system_id, component_id, &msg , packet1.message_id , packet1.interval_us );
  7060. mavlink_msg_message_interval_decode(&msg, &packet2);
  7061. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7062. memset(&packet2, 0, sizeof(packet2));
  7063. mavlink_msg_message_interval_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.message_id , packet1.interval_us );
  7064. mavlink_msg_message_interval_decode(&msg, &packet2);
  7065. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7066. memset(&packet2, 0, sizeof(packet2));
  7067. mavlink_msg_to_send_buffer(buffer, &msg);
  7068. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  7069. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  7070. }
  7071. mavlink_msg_message_interval_decode(last_msg, &packet2);
  7072. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7073. memset(&packet2, 0, sizeof(packet2));
  7074. mavlink_msg_message_interval_send(MAVLINK_COMM_1 , packet1.message_id , packet1.interval_us );
  7075. mavlink_msg_message_interval_decode(last_msg, &packet2);
  7076. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7077. }
  7078. static void mavlink_test_extended_sys_state(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  7079. {
  7080. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7081. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  7082. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_EXTENDED_SYS_STATE >= 256) {
  7083. return;
  7084. }
  7085. #endif
  7086. mavlink_message_t msg;
  7087. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  7088. uint16_t i;
  7089. mavlink_extended_sys_state_t packet_in = {
  7090. 5,72
  7091. };
  7092. mavlink_extended_sys_state_t packet1, packet2;
  7093. memset(&packet1, 0, sizeof(packet1));
  7094. packet1.vtol_state = packet_in.vtol_state;
  7095. packet1.landed_state = packet_in.landed_state;
  7096. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7097. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  7098. // cope with extensions
  7099. memset(MAVLINK_MSG_ID_EXTENDED_SYS_STATE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_EXTENDED_SYS_STATE_MIN_LEN);
  7100. }
  7101. #endif
  7102. memset(&packet2, 0, sizeof(packet2));
  7103. mavlink_msg_extended_sys_state_encode(system_id, component_id, &msg, &packet1);
  7104. mavlink_msg_extended_sys_state_decode(&msg, &packet2);
  7105. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7106. memset(&packet2, 0, sizeof(packet2));
  7107. mavlink_msg_extended_sys_state_pack(system_id, component_id, &msg , packet1.vtol_state , packet1.landed_state );
  7108. mavlink_msg_extended_sys_state_decode(&msg, &packet2);
  7109. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7110. memset(&packet2, 0, sizeof(packet2));
  7111. mavlink_msg_extended_sys_state_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.vtol_state , packet1.landed_state );
  7112. mavlink_msg_extended_sys_state_decode(&msg, &packet2);
  7113. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7114. memset(&packet2, 0, sizeof(packet2));
  7115. mavlink_msg_to_send_buffer(buffer, &msg);
  7116. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  7117. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  7118. }
  7119. mavlink_msg_extended_sys_state_decode(last_msg, &packet2);
  7120. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7121. memset(&packet2, 0, sizeof(packet2));
  7122. mavlink_msg_extended_sys_state_send(MAVLINK_COMM_1 , packet1.vtol_state , packet1.landed_state );
  7123. mavlink_msg_extended_sys_state_decode(last_msg, &packet2);
  7124. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7125. }
  7126. static void mavlink_test_adsb_vehicle(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  7127. {
  7128. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7129. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  7130. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ADSB_VEHICLE >= 256) {
  7131. return;
  7132. }
  7133. #endif
  7134. mavlink_message_t msg;
  7135. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  7136. uint16_t i;
  7137. mavlink_adsb_vehicle_t packet_in = {
  7138. 963497464,963497672,963497880,963498088,18067,18171,18275,18379,18483,211,"BCDEFGHI",113,180
  7139. };
  7140. mavlink_adsb_vehicle_t packet1, packet2;
  7141. memset(&packet1, 0, sizeof(packet1));
  7142. packet1.ICAO_address = packet_in.ICAO_address;
  7143. packet1.lat = packet_in.lat;
  7144. packet1.lon = packet_in.lon;
  7145. packet1.altitude = packet_in.altitude;
  7146. packet1.heading = packet_in.heading;
  7147. packet1.hor_velocity = packet_in.hor_velocity;
  7148. packet1.ver_velocity = packet_in.ver_velocity;
  7149. packet1.flags = packet_in.flags;
  7150. packet1.squawk = packet_in.squawk;
  7151. packet1.altitude_type = packet_in.altitude_type;
  7152. packet1.emitter_type = packet_in.emitter_type;
  7153. packet1.tslc = packet_in.tslc;
  7154. mav_array_memcpy(packet1.callsign, packet_in.callsign, sizeof(char)*9);
  7155. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7156. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  7157. // cope with extensions
  7158. memset(MAVLINK_MSG_ID_ADSB_VEHICLE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ADSB_VEHICLE_MIN_LEN);
  7159. }
  7160. #endif
  7161. memset(&packet2, 0, sizeof(packet2));
  7162. mavlink_msg_adsb_vehicle_encode(system_id, component_id, &msg, &packet1);
  7163. mavlink_msg_adsb_vehicle_decode(&msg, &packet2);
  7164. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7165. memset(&packet2, 0, sizeof(packet2));
  7166. mavlink_msg_adsb_vehicle_pack(system_id, component_id, &msg , packet1.ICAO_address , packet1.lat , packet1.lon , packet1.altitude_type , packet1.altitude , packet1.heading , packet1.hor_velocity , packet1.ver_velocity , packet1.callsign , packet1.emitter_type , packet1.tslc , packet1.flags , packet1.squawk );
  7167. mavlink_msg_adsb_vehicle_decode(&msg, &packet2);
  7168. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7169. memset(&packet2, 0, sizeof(packet2));
  7170. mavlink_msg_adsb_vehicle_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.ICAO_address , packet1.lat , packet1.lon , packet1.altitude_type , packet1.altitude , packet1.heading , packet1.hor_velocity , packet1.ver_velocity , packet1.callsign , packet1.emitter_type , packet1.tslc , packet1.flags , packet1.squawk );
  7171. mavlink_msg_adsb_vehicle_decode(&msg, &packet2);
  7172. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7173. memset(&packet2, 0, sizeof(packet2));
  7174. mavlink_msg_to_send_buffer(buffer, &msg);
  7175. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  7176. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  7177. }
  7178. mavlink_msg_adsb_vehicle_decode(last_msg, &packet2);
  7179. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7180. memset(&packet2, 0, sizeof(packet2));
  7181. mavlink_msg_adsb_vehicle_send(MAVLINK_COMM_1 , packet1.ICAO_address , packet1.lat , packet1.lon , packet1.altitude_type , packet1.altitude , packet1.heading , packet1.hor_velocity , packet1.ver_velocity , packet1.callsign , packet1.emitter_type , packet1.tslc , packet1.flags , packet1.squawk );
  7182. mavlink_msg_adsb_vehicle_decode(last_msg, &packet2);
  7183. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7184. }
  7185. static void mavlink_test_collision(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  7186. {
  7187. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7188. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  7189. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_COLLISION >= 256) {
  7190. return;
  7191. }
  7192. #endif
  7193. mavlink_message_t msg;
  7194. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  7195. uint16_t i;
  7196. mavlink_collision_t packet_in = {
  7197. 963497464,45.0,73.0,101.0,53,120,187
  7198. };
  7199. mavlink_collision_t packet1, packet2;
  7200. memset(&packet1, 0, sizeof(packet1));
  7201. packet1.id = packet_in.id;
  7202. packet1.time_to_minimum_delta = packet_in.time_to_minimum_delta;
  7203. packet1.altitude_minimum_delta = packet_in.altitude_minimum_delta;
  7204. packet1.horizontal_minimum_delta = packet_in.horizontal_minimum_delta;
  7205. packet1.src = packet_in.src;
  7206. packet1.action = packet_in.action;
  7207. packet1.threat_level = packet_in.threat_level;
  7208. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7209. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  7210. // cope with extensions
  7211. memset(MAVLINK_MSG_ID_COLLISION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_COLLISION_MIN_LEN);
  7212. }
  7213. #endif
  7214. memset(&packet2, 0, sizeof(packet2));
  7215. mavlink_msg_collision_encode(system_id, component_id, &msg, &packet1);
  7216. mavlink_msg_collision_decode(&msg, &packet2);
  7217. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7218. memset(&packet2, 0, sizeof(packet2));
  7219. mavlink_msg_collision_pack(system_id, component_id, &msg , packet1.src , packet1.id , packet1.action , packet1.threat_level , packet1.time_to_minimum_delta , packet1.altitude_minimum_delta , packet1.horizontal_minimum_delta );
  7220. mavlink_msg_collision_decode(&msg, &packet2);
  7221. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7222. memset(&packet2, 0, sizeof(packet2));
  7223. mavlink_msg_collision_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.src , packet1.id , packet1.action , packet1.threat_level , packet1.time_to_minimum_delta , packet1.altitude_minimum_delta , packet1.horizontal_minimum_delta );
  7224. mavlink_msg_collision_decode(&msg, &packet2);
  7225. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7226. memset(&packet2, 0, sizeof(packet2));
  7227. mavlink_msg_to_send_buffer(buffer, &msg);
  7228. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  7229. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  7230. }
  7231. mavlink_msg_collision_decode(last_msg, &packet2);
  7232. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7233. memset(&packet2, 0, sizeof(packet2));
  7234. mavlink_msg_collision_send(MAVLINK_COMM_1 , packet1.src , packet1.id , packet1.action , packet1.threat_level , packet1.time_to_minimum_delta , packet1.altitude_minimum_delta , packet1.horizontal_minimum_delta );
  7235. mavlink_msg_collision_decode(last_msg, &packet2);
  7236. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7237. }
  7238. static void mavlink_test_v2_extension(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  7239. {
  7240. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7241. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  7242. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_V2_EXTENSION >= 256) {
  7243. return;
  7244. }
  7245. #endif
  7246. mavlink_message_t msg;
  7247. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  7248. uint16_t i;
  7249. mavlink_v2_extension_t packet_in = {
  7250. 17235,139,206,17,{ 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76 }
  7251. };
  7252. mavlink_v2_extension_t packet1, packet2;
  7253. memset(&packet1, 0, sizeof(packet1));
  7254. packet1.message_type = packet_in.message_type;
  7255. packet1.target_network = packet_in.target_network;
  7256. packet1.target_system = packet_in.target_system;
  7257. packet1.target_component = packet_in.target_component;
  7258. mav_array_memcpy(packet1.payload, packet_in.payload, sizeof(uint8_t)*249);
  7259. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7260. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  7261. // cope with extensions
  7262. memset(MAVLINK_MSG_ID_V2_EXTENSION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_V2_EXTENSION_MIN_LEN);
  7263. }
  7264. #endif
  7265. memset(&packet2, 0, sizeof(packet2));
  7266. mavlink_msg_v2_extension_encode(system_id, component_id, &msg, &packet1);
  7267. mavlink_msg_v2_extension_decode(&msg, &packet2);
  7268. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7269. memset(&packet2, 0, sizeof(packet2));
  7270. mavlink_msg_v2_extension_pack(system_id, component_id, &msg , packet1.target_network , packet1.target_system , packet1.target_component , packet1.message_type , packet1.payload );
  7271. mavlink_msg_v2_extension_decode(&msg, &packet2);
  7272. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7273. memset(&packet2, 0, sizeof(packet2));
  7274. mavlink_msg_v2_extension_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_network , packet1.target_system , packet1.target_component , packet1.message_type , packet1.payload );
  7275. mavlink_msg_v2_extension_decode(&msg, &packet2);
  7276. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7277. memset(&packet2, 0, sizeof(packet2));
  7278. mavlink_msg_to_send_buffer(buffer, &msg);
  7279. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  7280. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  7281. }
  7282. mavlink_msg_v2_extension_decode(last_msg, &packet2);
  7283. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7284. memset(&packet2, 0, sizeof(packet2));
  7285. mavlink_msg_v2_extension_send(MAVLINK_COMM_1 , packet1.target_network , packet1.target_system , packet1.target_component , packet1.message_type , packet1.payload );
  7286. mavlink_msg_v2_extension_decode(last_msg, &packet2);
  7287. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7288. }
  7289. static void mavlink_test_memory_vect(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  7290. {
  7291. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7292. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  7293. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MEMORY_VECT >= 256) {
  7294. return;
  7295. }
  7296. #endif
  7297. mavlink_message_t msg;
  7298. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  7299. uint16_t i;
  7300. mavlink_memory_vect_t packet_in = {
  7301. 17235,139,206,{ 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48 }
  7302. };
  7303. mavlink_memory_vect_t packet1, packet2;
  7304. memset(&packet1, 0, sizeof(packet1));
  7305. packet1.address = packet_in.address;
  7306. packet1.ver = packet_in.ver;
  7307. packet1.type = packet_in.type;
  7308. mav_array_memcpy(packet1.value, packet_in.value, sizeof(int8_t)*32);
  7309. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7310. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  7311. // cope with extensions
  7312. memset(MAVLINK_MSG_ID_MEMORY_VECT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MEMORY_VECT_MIN_LEN);
  7313. }
  7314. #endif
  7315. memset(&packet2, 0, sizeof(packet2));
  7316. mavlink_msg_memory_vect_encode(system_id, component_id, &msg, &packet1);
  7317. mavlink_msg_memory_vect_decode(&msg, &packet2);
  7318. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7319. memset(&packet2, 0, sizeof(packet2));
  7320. mavlink_msg_memory_vect_pack(system_id, component_id, &msg , packet1.address , packet1.ver , packet1.type , packet1.value );
  7321. mavlink_msg_memory_vect_decode(&msg, &packet2);
  7322. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7323. memset(&packet2, 0, sizeof(packet2));
  7324. mavlink_msg_memory_vect_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.address , packet1.ver , packet1.type , packet1.value );
  7325. mavlink_msg_memory_vect_decode(&msg, &packet2);
  7326. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7327. memset(&packet2, 0, sizeof(packet2));
  7328. mavlink_msg_to_send_buffer(buffer, &msg);
  7329. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  7330. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  7331. }
  7332. mavlink_msg_memory_vect_decode(last_msg, &packet2);
  7333. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7334. memset(&packet2, 0, sizeof(packet2));
  7335. mavlink_msg_memory_vect_send(MAVLINK_COMM_1 , packet1.address , packet1.ver , packet1.type , packet1.value );
  7336. mavlink_msg_memory_vect_decode(last_msg, &packet2);
  7337. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7338. }
  7339. static void mavlink_test_debug_vect(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  7340. {
  7341. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7342. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  7343. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_DEBUG_VECT >= 256) {
  7344. return;
  7345. }
  7346. #endif
  7347. mavlink_message_t msg;
  7348. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  7349. uint16_t i;
  7350. mavlink_debug_vect_t packet_in = {
  7351. 93372036854775807ULL,73.0,101.0,129.0,"UVWXYZABC"
  7352. };
  7353. mavlink_debug_vect_t packet1, packet2;
  7354. memset(&packet1, 0, sizeof(packet1));
  7355. packet1.time_usec = packet_in.time_usec;
  7356. packet1.x = packet_in.x;
  7357. packet1.y = packet_in.y;
  7358. packet1.z = packet_in.z;
  7359. mav_array_memcpy(packet1.name, packet_in.name, sizeof(char)*10);
  7360. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7361. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  7362. // cope with extensions
  7363. memset(MAVLINK_MSG_ID_DEBUG_VECT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_DEBUG_VECT_MIN_LEN);
  7364. }
  7365. #endif
  7366. memset(&packet2, 0, sizeof(packet2));
  7367. mavlink_msg_debug_vect_encode(system_id, component_id, &msg, &packet1);
  7368. mavlink_msg_debug_vect_decode(&msg, &packet2);
  7369. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7370. memset(&packet2, 0, sizeof(packet2));
  7371. mavlink_msg_debug_vect_pack(system_id, component_id, &msg , packet1.name , packet1.time_usec , packet1.x , packet1.y , packet1.z );
  7372. mavlink_msg_debug_vect_decode(&msg, &packet2);
  7373. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7374. memset(&packet2, 0, sizeof(packet2));
  7375. mavlink_msg_debug_vect_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.name , packet1.time_usec , packet1.x , packet1.y , packet1.z );
  7376. mavlink_msg_debug_vect_decode(&msg, &packet2);
  7377. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7378. memset(&packet2, 0, sizeof(packet2));
  7379. mavlink_msg_to_send_buffer(buffer, &msg);
  7380. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  7381. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  7382. }
  7383. mavlink_msg_debug_vect_decode(last_msg, &packet2);
  7384. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7385. memset(&packet2, 0, sizeof(packet2));
  7386. mavlink_msg_debug_vect_send(MAVLINK_COMM_1 , packet1.name , packet1.time_usec , packet1.x , packet1.y , packet1.z );
  7387. mavlink_msg_debug_vect_decode(last_msg, &packet2);
  7388. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7389. }
  7390. static void mavlink_test_named_value_float(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  7391. {
  7392. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7393. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  7394. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_NAMED_VALUE_FLOAT >= 256) {
  7395. return;
  7396. }
  7397. #endif
  7398. mavlink_message_t msg;
  7399. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  7400. uint16_t i;
  7401. mavlink_named_value_float_t packet_in = {
  7402. 963497464,45.0,"IJKLMNOPQ"
  7403. };
  7404. mavlink_named_value_float_t packet1, packet2;
  7405. memset(&packet1, 0, sizeof(packet1));
  7406. packet1.time_boot_ms = packet_in.time_boot_ms;
  7407. packet1.value = packet_in.value;
  7408. mav_array_memcpy(packet1.name, packet_in.name, sizeof(char)*10);
  7409. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7410. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  7411. // cope with extensions
  7412. memset(MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_MIN_LEN);
  7413. }
  7414. #endif
  7415. memset(&packet2, 0, sizeof(packet2));
  7416. mavlink_msg_named_value_float_encode(system_id, component_id, &msg, &packet1);
  7417. mavlink_msg_named_value_float_decode(&msg, &packet2);
  7418. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7419. memset(&packet2, 0, sizeof(packet2));
  7420. mavlink_msg_named_value_float_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.name , packet1.value );
  7421. mavlink_msg_named_value_float_decode(&msg, &packet2);
  7422. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7423. memset(&packet2, 0, sizeof(packet2));
  7424. mavlink_msg_named_value_float_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.name , packet1.value );
  7425. mavlink_msg_named_value_float_decode(&msg, &packet2);
  7426. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7427. memset(&packet2, 0, sizeof(packet2));
  7428. mavlink_msg_to_send_buffer(buffer, &msg);
  7429. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  7430. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  7431. }
  7432. mavlink_msg_named_value_float_decode(last_msg, &packet2);
  7433. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7434. memset(&packet2, 0, sizeof(packet2));
  7435. mavlink_msg_named_value_float_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.name , packet1.value );
  7436. mavlink_msg_named_value_float_decode(last_msg, &packet2);
  7437. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7438. }
  7439. static void mavlink_test_named_value_int(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  7440. {
  7441. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7442. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  7443. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_NAMED_VALUE_INT >= 256) {
  7444. return;
  7445. }
  7446. #endif
  7447. mavlink_message_t msg;
  7448. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  7449. uint16_t i;
  7450. mavlink_named_value_int_t packet_in = {
  7451. 963497464,963497672,"IJKLMNOPQ"
  7452. };
  7453. mavlink_named_value_int_t packet1, packet2;
  7454. memset(&packet1, 0, sizeof(packet1));
  7455. packet1.time_boot_ms = packet_in.time_boot_ms;
  7456. packet1.value = packet_in.value;
  7457. mav_array_memcpy(packet1.name, packet_in.name, sizeof(char)*10);
  7458. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7459. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  7460. // cope with extensions
  7461. memset(MAVLINK_MSG_ID_NAMED_VALUE_INT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_NAMED_VALUE_INT_MIN_LEN);
  7462. }
  7463. #endif
  7464. memset(&packet2, 0, sizeof(packet2));
  7465. mavlink_msg_named_value_int_encode(system_id, component_id, &msg, &packet1);
  7466. mavlink_msg_named_value_int_decode(&msg, &packet2);
  7467. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7468. memset(&packet2, 0, sizeof(packet2));
  7469. mavlink_msg_named_value_int_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.name , packet1.value );
  7470. mavlink_msg_named_value_int_decode(&msg, &packet2);
  7471. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7472. memset(&packet2, 0, sizeof(packet2));
  7473. mavlink_msg_named_value_int_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.name , packet1.value );
  7474. mavlink_msg_named_value_int_decode(&msg, &packet2);
  7475. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7476. memset(&packet2, 0, sizeof(packet2));
  7477. mavlink_msg_to_send_buffer(buffer, &msg);
  7478. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  7479. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  7480. }
  7481. mavlink_msg_named_value_int_decode(last_msg, &packet2);
  7482. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7483. memset(&packet2, 0, sizeof(packet2));
  7484. mavlink_msg_named_value_int_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.name , packet1.value );
  7485. mavlink_msg_named_value_int_decode(last_msg, &packet2);
  7486. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7487. }
  7488. static void mavlink_test_statustext(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  7489. {
  7490. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7491. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  7492. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_STATUSTEXT >= 256) {
  7493. return;
  7494. }
  7495. #endif
  7496. mavlink_message_t msg;
  7497. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  7498. uint16_t i;
  7499. mavlink_statustext_t packet_in = {
  7500. 5,"BCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWX"
  7501. };
  7502. mavlink_statustext_t packet1, packet2;
  7503. memset(&packet1, 0, sizeof(packet1));
  7504. packet1.severity = packet_in.severity;
  7505. mav_array_memcpy(packet1.text, packet_in.text, sizeof(char)*50);
  7506. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7507. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  7508. // cope with extensions
  7509. memset(MAVLINK_MSG_ID_STATUSTEXT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_STATUSTEXT_MIN_LEN);
  7510. }
  7511. #endif
  7512. memset(&packet2, 0, sizeof(packet2));
  7513. mavlink_msg_statustext_encode(system_id, component_id, &msg, &packet1);
  7514. mavlink_msg_statustext_decode(&msg, &packet2);
  7515. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7516. memset(&packet2, 0, sizeof(packet2));
  7517. mavlink_msg_statustext_pack(system_id, component_id, &msg , packet1.severity , packet1.text );
  7518. mavlink_msg_statustext_decode(&msg, &packet2);
  7519. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7520. memset(&packet2, 0, sizeof(packet2));
  7521. mavlink_msg_statustext_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.severity , packet1.text );
  7522. mavlink_msg_statustext_decode(&msg, &packet2);
  7523. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7524. memset(&packet2, 0, sizeof(packet2));
  7525. mavlink_msg_to_send_buffer(buffer, &msg);
  7526. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  7527. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  7528. }
  7529. mavlink_msg_statustext_decode(last_msg, &packet2);
  7530. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7531. memset(&packet2, 0, sizeof(packet2));
  7532. mavlink_msg_statustext_send(MAVLINK_COMM_1 , packet1.severity , packet1.text );
  7533. mavlink_msg_statustext_decode(last_msg, &packet2);
  7534. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7535. }
  7536. static void mavlink_test_debug(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  7537. {
  7538. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7539. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  7540. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_DEBUG >= 256) {
  7541. return;
  7542. }
  7543. #endif
  7544. mavlink_message_t msg;
  7545. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  7546. uint16_t i;
  7547. mavlink_debug_t packet_in = {
  7548. 963497464,45.0,29
  7549. };
  7550. mavlink_debug_t packet1, packet2;
  7551. memset(&packet1, 0, sizeof(packet1));
  7552. packet1.time_boot_ms = packet_in.time_boot_ms;
  7553. packet1.value = packet_in.value;
  7554. packet1.ind = packet_in.ind;
  7555. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7556. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  7557. // cope with extensions
  7558. memset(MAVLINK_MSG_ID_DEBUG_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_DEBUG_MIN_LEN);
  7559. }
  7560. #endif
  7561. memset(&packet2, 0, sizeof(packet2));
  7562. mavlink_msg_debug_encode(system_id, component_id, &msg, &packet1);
  7563. mavlink_msg_debug_decode(&msg, &packet2);
  7564. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7565. memset(&packet2, 0, sizeof(packet2));
  7566. mavlink_msg_debug_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.ind , packet1.value );
  7567. mavlink_msg_debug_decode(&msg, &packet2);
  7568. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7569. memset(&packet2, 0, sizeof(packet2));
  7570. mavlink_msg_debug_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.ind , packet1.value );
  7571. mavlink_msg_debug_decode(&msg, &packet2);
  7572. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7573. memset(&packet2, 0, sizeof(packet2));
  7574. mavlink_msg_to_send_buffer(buffer, &msg);
  7575. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  7576. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  7577. }
  7578. mavlink_msg_debug_decode(last_msg, &packet2);
  7579. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7580. memset(&packet2, 0, sizeof(packet2));
  7581. mavlink_msg_debug_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.ind , packet1.value );
  7582. mavlink_msg_debug_decode(last_msg, &packet2);
  7583. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7584. }
  7585. static void mavlink_test_setup_signing(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  7586. {
  7587. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7588. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  7589. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SETUP_SIGNING >= 256) {
  7590. return;
  7591. }
  7592. #endif
  7593. mavlink_message_t msg;
  7594. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  7595. uint16_t i;
  7596. mavlink_setup_signing_t packet_in = {
  7597. 93372036854775807ULL,29,96,{ 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194 }
  7598. };
  7599. mavlink_setup_signing_t packet1, packet2;
  7600. memset(&packet1, 0, sizeof(packet1));
  7601. packet1.initial_timestamp = packet_in.initial_timestamp;
  7602. packet1.target_system = packet_in.target_system;
  7603. packet1.target_component = packet_in.target_component;
  7604. mav_array_memcpy(packet1.secret_key, packet_in.secret_key, sizeof(uint8_t)*32);
  7605. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7606. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  7607. // cope with extensions
  7608. memset(MAVLINK_MSG_ID_SETUP_SIGNING_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SETUP_SIGNING_MIN_LEN);
  7609. }
  7610. #endif
  7611. memset(&packet2, 0, sizeof(packet2));
  7612. mavlink_msg_setup_signing_encode(system_id, component_id, &msg, &packet1);
  7613. mavlink_msg_setup_signing_decode(&msg, &packet2);
  7614. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7615. memset(&packet2, 0, sizeof(packet2));
  7616. mavlink_msg_setup_signing_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.secret_key , packet1.initial_timestamp );
  7617. mavlink_msg_setup_signing_decode(&msg, &packet2);
  7618. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7619. memset(&packet2, 0, sizeof(packet2));
  7620. mavlink_msg_setup_signing_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.secret_key , packet1.initial_timestamp );
  7621. mavlink_msg_setup_signing_decode(&msg, &packet2);
  7622. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7623. memset(&packet2, 0, sizeof(packet2));
  7624. mavlink_msg_to_send_buffer(buffer, &msg);
  7625. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  7626. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  7627. }
  7628. mavlink_msg_setup_signing_decode(last_msg, &packet2);
  7629. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7630. memset(&packet2, 0, sizeof(packet2));
  7631. mavlink_msg_setup_signing_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.secret_key , packet1.initial_timestamp );
  7632. mavlink_msg_setup_signing_decode(last_msg, &packet2);
  7633. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7634. }
  7635. static void mavlink_test_button_change(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  7636. {
  7637. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7638. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  7639. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_BUTTON_CHANGE >= 256) {
  7640. return;
  7641. }
  7642. #endif
  7643. mavlink_message_t msg;
  7644. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  7645. uint16_t i;
  7646. mavlink_button_change_t packet_in = {
  7647. 963497464,963497672,29
  7648. };
  7649. mavlink_button_change_t packet1, packet2;
  7650. memset(&packet1, 0, sizeof(packet1));
  7651. packet1.time_boot_ms = packet_in.time_boot_ms;
  7652. packet1.last_change_ms = packet_in.last_change_ms;
  7653. packet1.state = packet_in.state;
  7654. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7655. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  7656. // cope with extensions
  7657. memset(MAVLINK_MSG_ID_BUTTON_CHANGE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_BUTTON_CHANGE_MIN_LEN);
  7658. }
  7659. #endif
  7660. memset(&packet2, 0, sizeof(packet2));
  7661. mavlink_msg_button_change_encode(system_id, component_id, &msg, &packet1);
  7662. mavlink_msg_button_change_decode(&msg, &packet2);
  7663. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7664. memset(&packet2, 0, sizeof(packet2));
  7665. mavlink_msg_button_change_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.last_change_ms , packet1.state );
  7666. mavlink_msg_button_change_decode(&msg, &packet2);
  7667. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7668. memset(&packet2, 0, sizeof(packet2));
  7669. mavlink_msg_button_change_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.last_change_ms , packet1.state );
  7670. mavlink_msg_button_change_decode(&msg, &packet2);
  7671. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7672. memset(&packet2, 0, sizeof(packet2));
  7673. mavlink_msg_to_send_buffer(buffer, &msg);
  7674. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  7675. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  7676. }
  7677. mavlink_msg_button_change_decode(last_msg, &packet2);
  7678. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7679. memset(&packet2, 0, sizeof(packet2));
  7680. mavlink_msg_button_change_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.last_change_ms , packet1.state );
  7681. mavlink_msg_button_change_decode(last_msg, &packet2);
  7682. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7683. }
  7684. static void mavlink_test_play_tune(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  7685. {
  7686. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7687. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  7688. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_PLAY_TUNE >= 256) {
  7689. return;
  7690. }
  7691. #endif
  7692. mavlink_message_t msg;
  7693. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  7694. uint16_t i;
  7695. mavlink_play_tune_t packet_in = {
  7696. 5,72,"CDEFGHIJKLMNOPQRSTUVWXYZABCDE","GHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVW"
  7697. };
  7698. mavlink_play_tune_t packet1, packet2;
  7699. memset(&packet1, 0, sizeof(packet1));
  7700. packet1.target_system = packet_in.target_system;
  7701. packet1.target_component = packet_in.target_component;
  7702. mav_array_memcpy(packet1.tune, packet_in.tune, sizeof(char)*30);
  7703. mav_array_memcpy(packet1.tune2, packet_in.tune2, sizeof(char)*200);
  7704. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7705. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  7706. // cope with extensions
  7707. memset(MAVLINK_MSG_ID_PLAY_TUNE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_PLAY_TUNE_MIN_LEN);
  7708. }
  7709. #endif
  7710. memset(&packet2, 0, sizeof(packet2));
  7711. mavlink_msg_play_tune_encode(system_id, component_id, &msg, &packet1);
  7712. mavlink_msg_play_tune_decode(&msg, &packet2);
  7713. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7714. memset(&packet2, 0, sizeof(packet2));
  7715. mavlink_msg_play_tune_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.tune , packet1.tune2 );
  7716. mavlink_msg_play_tune_decode(&msg, &packet2);
  7717. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7718. memset(&packet2, 0, sizeof(packet2));
  7719. mavlink_msg_play_tune_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.tune , packet1.tune2 );
  7720. mavlink_msg_play_tune_decode(&msg, &packet2);
  7721. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7722. memset(&packet2, 0, sizeof(packet2));
  7723. mavlink_msg_to_send_buffer(buffer, &msg);
  7724. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  7725. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  7726. }
  7727. mavlink_msg_play_tune_decode(last_msg, &packet2);
  7728. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7729. memset(&packet2, 0, sizeof(packet2));
  7730. mavlink_msg_play_tune_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.tune , packet1.tune2 );
  7731. mavlink_msg_play_tune_decode(last_msg, &packet2);
  7732. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7733. }
  7734. static void mavlink_test_camera_information(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  7735. {
  7736. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7737. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  7738. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_CAMERA_INFORMATION >= 256) {
  7739. return;
  7740. }
  7741. #endif
  7742. mavlink_message_t msg;
  7743. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  7744. uint16_t i;
  7745. mavlink_camera_information_t packet_in = {
  7746. 963497464,963497672,73.0,101.0,129.0,963498504,18483,18587,18691,{ 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254 },{ 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94 },159,"RSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
  7747. };
  7748. mavlink_camera_information_t packet1, packet2;
  7749. memset(&packet1, 0, sizeof(packet1));
  7750. packet1.time_boot_ms = packet_in.time_boot_ms;
  7751. packet1.firmware_version = packet_in.firmware_version;
  7752. packet1.focal_length = packet_in.focal_length;
  7753. packet1.sensor_size_h = packet_in.sensor_size_h;
  7754. packet1.sensor_size_v = packet_in.sensor_size_v;
  7755. packet1.flags = packet_in.flags;
  7756. packet1.resolution_h = packet_in.resolution_h;
  7757. packet1.resolution_v = packet_in.resolution_v;
  7758. packet1.cam_definition_version = packet_in.cam_definition_version;
  7759. packet1.lens_id = packet_in.lens_id;
  7760. mav_array_memcpy(packet1.vendor_name, packet_in.vendor_name, sizeof(uint8_t)*32);
  7761. mav_array_memcpy(packet1.model_name, packet_in.model_name, sizeof(uint8_t)*32);
  7762. mav_array_memcpy(packet1.cam_definition_uri, packet_in.cam_definition_uri, sizeof(char)*140);
  7763. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7764. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  7765. // cope with extensions
  7766. memset(MAVLINK_MSG_ID_CAMERA_INFORMATION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_CAMERA_INFORMATION_MIN_LEN);
  7767. }
  7768. #endif
  7769. memset(&packet2, 0, sizeof(packet2));
  7770. mavlink_msg_camera_information_encode(system_id, component_id, &msg, &packet1);
  7771. mavlink_msg_camera_information_decode(&msg, &packet2);
  7772. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7773. memset(&packet2, 0, sizeof(packet2));
  7774. mavlink_msg_camera_information_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.vendor_name , packet1.model_name , packet1.firmware_version , packet1.focal_length , packet1.sensor_size_h , packet1.sensor_size_v , packet1.resolution_h , packet1.resolution_v , packet1.lens_id , packet1.flags , packet1.cam_definition_version , packet1.cam_definition_uri );
  7775. mavlink_msg_camera_information_decode(&msg, &packet2);
  7776. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7777. memset(&packet2, 0, sizeof(packet2));
  7778. mavlink_msg_camera_information_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.vendor_name , packet1.model_name , packet1.firmware_version , packet1.focal_length , packet1.sensor_size_h , packet1.sensor_size_v , packet1.resolution_h , packet1.resolution_v , packet1.lens_id , packet1.flags , packet1.cam_definition_version , packet1.cam_definition_uri );
  7779. mavlink_msg_camera_information_decode(&msg, &packet2);
  7780. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7781. memset(&packet2, 0, sizeof(packet2));
  7782. mavlink_msg_to_send_buffer(buffer, &msg);
  7783. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  7784. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  7785. }
  7786. mavlink_msg_camera_information_decode(last_msg, &packet2);
  7787. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7788. memset(&packet2, 0, sizeof(packet2));
  7789. mavlink_msg_camera_information_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.vendor_name , packet1.model_name , packet1.firmware_version , packet1.focal_length , packet1.sensor_size_h , packet1.sensor_size_v , packet1.resolution_h , packet1.resolution_v , packet1.lens_id , packet1.flags , packet1.cam_definition_version , packet1.cam_definition_uri );
  7790. mavlink_msg_camera_information_decode(last_msg, &packet2);
  7791. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7792. }
  7793. static void mavlink_test_camera_settings(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  7794. {
  7795. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7796. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  7797. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_CAMERA_SETTINGS >= 256) {
  7798. return;
  7799. }
  7800. #endif
  7801. mavlink_message_t msg;
  7802. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  7803. uint16_t i;
  7804. mavlink_camera_settings_t packet_in = {
  7805. 963497464,17,52.0,80.0
  7806. };
  7807. mavlink_camera_settings_t packet1, packet2;
  7808. memset(&packet1, 0, sizeof(packet1));
  7809. packet1.time_boot_ms = packet_in.time_boot_ms;
  7810. packet1.mode_id = packet_in.mode_id;
  7811. packet1.zoomLevel = packet_in.zoomLevel;
  7812. packet1.focusLevel = packet_in.focusLevel;
  7813. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7814. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  7815. // cope with extensions
  7816. memset(MAVLINK_MSG_ID_CAMERA_SETTINGS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_CAMERA_SETTINGS_MIN_LEN);
  7817. }
  7818. #endif
  7819. memset(&packet2, 0, sizeof(packet2));
  7820. mavlink_msg_camera_settings_encode(system_id, component_id, &msg, &packet1);
  7821. mavlink_msg_camera_settings_decode(&msg, &packet2);
  7822. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7823. memset(&packet2, 0, sizeof(packet2));
  7824. mavlink_msg_camera_settings_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.mode_id , packet1.zoomLevel , packet1.focusLevel );
  7825. mavlink_msg_camera_settings_decode(&msg, &packet2);
  7826. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7827. memset(&packet2, 0, sizeof(packet2));
  7828. mavlink_msg_camera_settings_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.mode_id , packet1.zoomLevel , packet1.focusLevel );
  7829. mavlink_msg_camera_settings_decode(&msg, &packet2);
  7830. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7831. memset(&packet2, 0, sizeof(packet2));
  7832. mavlink_msg_to_send_buffer(buffer, &msg);
  7833. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  7834. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  7835. }
  7836. mavlink_msg_camera_settings_decode(last_msg, &packet2);
  7837. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7838. memset(&packet2, 0, sizeof(packet2));
  7839. mavlink_msg_camera_settings_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.mode_id , packet1.zoomLevel , packet1.focusLevel );
  7840. mavlink_msg_camera_settings_decode(last_msg, &packet2);
  7841. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7842. }
  7843. static void mavlink_test_storage_information(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  7844. {
  7845. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7846. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  7847. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_STORAGE_INFORMATION >= 256) {
  7848. return;
  7849. }
  7850. #endif
  7851. mavlink_message_t msg;
  7852. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  7853. uint16_t i;
  7854. mavlink_storage_information_t packet_in = {
  7855. 963497464,45.0,73.0,101.0,129.0,157.0,77,144,211
  7856. };
  7857. mavlink_storage_information_t packet1, packet2;
  7858. memset(&packet1, 0, sizeof(packet1));
  7859. packet1.time_boot_ms = packet_in.time_boot_ms;
  7860. packet1.total_capacity = packet_in.total_capacity;
  7861. packet1.used_capacity = packet_in.used_capacity;
  7862. packet1.available_capacity = packet_in.available_capacity;
  7863. packet1.read_speed = packet_in.read_speed;
  7864. packet1.write_speed = packet_in.write_speed;
  7865. packet1.storage_id = packet_in.storage_id;
  7866. packet1.storage_count = packet_in.storage_count;
  7867. packet1.status = packet_in.status;
  7868. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7869. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  7870. // cope with extensions
  7871. memset(MAVLINK_MSG_ID_STORAGE_INFORMATION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_STORAGE_INFORMATION_MIN_LEN);
  7872. }
  7873. #endif
  7874. memset(&packet2, 0, sizeof(packet2));
  7875. mavlink_msg_storage_information_encode(system_id, component_id, &msg, &packet1);
  7876. mavlink_msg_storage_information_decode(&msg, &packet2);
  7877. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7878. memset(&packet2, 0, sizeof(packet2));
  7879. mavlink_msg_storage_information_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.storage_id , packet1.storage_count , packet1.status , packet1.total_capacity , packet1.used_capacity , packet1.available_capacity , packet1.read_speed , packet1.write_speed );
  7880. mavlink_msg_storage_information_decode(&msg, &packet2);
  7881. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7882. memset(&packet2, 0, sizeof(packet2));
  7883. mavlink_msg_storage_information_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.storage_id , packet1.storage_count , packet1.status , packet1.total_capacity , packet1.used_capacity , packet1.available_capacity , packet1.read_speed , packet1.write_speed );
  7884. mavlink_msg_storage_information_decode(&msg, &packet2);
  7885. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7886. memset(&packet2, 0, sizeof(packet2));
  7887. mavlink_msg_to_send_buffer(buffer, &msg);
  7888. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  7889. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  7890. }
  7891. mavlink_msg_storage_information_decode(last_msg, &packet2);
  7892. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7893. memset(&packet2, 0, sizeof(packet2));
  7894. mavlink_msg_storage_information_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.storage_id , packet1.storage_count , packet1.status , packet1.total_capacity , packet1.used_capacity , packet1.available_capacity , packet1.read_speed , packet1.write_speed );
  7895. mavlink_msg_storage_information_decode(last_msg, &packet2);
  7896. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7897. }
  7898. static void mavlink_test_camera_capture_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  7899. {
  7900. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7901. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  7902. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS >= 256) {
  7903. return;
  7904. }
  7905. #endif
  7906. mavlink_message_t msg;
  7907. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  7908. uint16_t i;
  7909. mavlink_camera_capture_status_t packet_in = {
  7910. 963497464,45.0,963497880,101.0,53,120
  7911. };
  7912. mavlink_camera_capture_status_t packet1, packet2;
  7913. memset(&packet1, 0, sizeof(packet1));
  7914. packet1.time_boot_ms = packet_in.time_boot_ms;
  7915. packet1.image_interval = packet_in.image_interval;
  7916. packet1.recording_time_ms = packet_in.recording_time_ms;
  7917. packet1.available_capacity = packet_in.available_capacity;
  7918. packet1.image_status = packet_in.image_status;
  7919. packet1.video_status = packet_in.video_status;
  7920. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7921. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  7922. // cope with extensions
  7923. memset(MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_MIN_LEN);
  7924. }
  7925. #endif
  7926. memset(&packet2, 0, sizeof(packet2));
  7927. mavlink_msg_camera_capture_status_encode(system_id, component_id, &msg, &packet1);
  7928. mavlink_msg_camera_capture_status_decode(&msg, &packet2);
  7929. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7930. memset(&packet2, 0, sizeof(packet2));
  7931. mavlink_msg_camera_capture_status_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.image_status , packet1.video_status , packet1.image_interval , packet1.recording_time_ms , packet1.available_capacity );
  7932. mavlink_msg_camera_capture_status_decode(&msg, &packet2);
  7933. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7934. memset(&packet2, 0, sizeof(packet2));
  7935. mavlink_msg_camera_capture_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.image_status , packet1.video_status , packet1.image_interval , packet1.recording_time_ms , packet1.available_capacity );
  7936. mavlink_msg_camera_capture_status_decode(&msg, &packet2);
  7937. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7938. memset(&packet2, 0, sizeof(packet2));
  7939. mavlink_msg_to_send_buffer(buffer, &msg);
  7940. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  7941. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  7942. }
  7943. mavlink_msg_camera_capture_status_decode(last_msg, &packet2);
  7944. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7945. memset(&packet2, 0, sizeof(packet2));
  7946. mavlink_msg_camera_capture_status_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.image_status , packet1.video_status , packet1.image_interval , packet1.recording_time_ms , packet1.available_capacity );
  7947. mavlink_msg_camera_capture_status_decode(last_msg, &packet2);
  7948. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7949. }
  7950. static void mavlink_test_camera_image_captured(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  7951. {
  7952. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7953. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  7954. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED >= 256) {
  7955. return;
  7956. }
  7957. #endif
  7958. mavlink_message_t msg;
  7959. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  7960. uint16_t i;
  7961. mavlink_camera_image_captured_t packet_in = {
  7962. 93372036854775807ULL,963497880,963498088,963498296,963498504,963498712,{ 213.0, 214.0, 215.0, 216.0 },963499752,149,216,"YZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST"
  7963. };
  7964. mavlink_camera_image_captured_t packet1, packet2;
  7965. memset(&packet1, 0, sizeof(packet1));
  7966. packet1.time_utc = packet_in.time_utc;
  7967. packet1.time_boot_ms = packet_in.time_boot_ms;
  7968. packet1.lat = packet_in.lat;
  7969. packet1.lon = packet_in.lon;
  7970. packet1.alt = packet_in.alt;
  7971. packet1.relative_alt = packet_in.relative_alt;
  7972. packet1.image_index = packet_in.image_index;
  7973. packet1.camera_id = packet_in.camera_id;
  7974. packet1.capture_result = packet_in.capture_result;
  7975. mav_array_memcpy(packet1.q, packet_in.q, sizeof(float)*4);
  7976. mav_array_memcpy(packet1.file_url, packet_in.file_url, sizeof(char)*205);
  7977. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  7978. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  7979. // cope with extensions
  7980. memset(MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_MIN_LEN);
  7981. }
  7982. #endif
  7983. memset(&packet2, 0, sizeof(packet2));
  7984. mavlink_msg_camera_image_captured_encode(system_id, component_id, &msg, &packet1);
  7985. mavlink_msg_camera_image_captured_decode(&msg, &packet2);
  7986. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7987. memset(&packet2, 0, sizeof(packet2));
  7988. mavlink_msg_camera_image_captured_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.time_utc , packet1.camera_id , packet1.lat , packet1.lon , packet1.alt , packet1.relative_alt , packet1.q , packet1.image_index , packet1.capture_result , packet1.file_url );
  7989. mavlink_msg_camera_image_captured_decode(&msg, &packet2);
  7990. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7991. memset(&packet2, 0, sizeof(packet2));
  7992. mavlink_msg_camera_image_captured_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.time_utc , packet1.camera_id , packet1.lat , packet1.lon , packet1.alt , packet1.relative_alt , packet1.q , packet1.image_index , packet1.capture_result , packet1.file_url );
  7993. mavlink_msg_camera_image_captured_decode(&msg, &packet2);
  7994. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  7995. memset(&packet2, 0, sizeof(packet2));
  7996. mavlink_msg_to_send_buffer(buffer, &msg);
  7997. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  7998. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  7999. }
  8000. mavlink_msg_camera_image_captured_decode(last_msg, &packet2);
  8001. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8002. memset(&packet2, 0, sizeof(packet2));
  8003. mavlink_msg_camera_image_captured_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.time_utc , packet1.camera_id , packet1.lat , packet1.lon , packet1.alt , packet1.relative_alt , packet1.q , packet1.image_index , packet1.capture_result , packet1.file_url );
  8004. mavlink_msg_camera_image_captured_decode(last_msg, &packet2);
  8005. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8006. }
  8007. static void mavlink_test_flight_information(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  8008. {
  8009. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  8010. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  8011. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_FLIGHT_INFORMATION >= 256) {
  8012. return;
  8013. }
  8014. #endif
  8015. mavlink_message_t msg;
  8016. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  8017. uint16_t i;
  8018. mavlink_flight_information_t packet_in = {
  8019. 93372036854775807ULL,93372036854776311ULL,93372036854776815ULL,963498712
  8020. };
  8021. mavlink_flight_information_t packet1, packet2;
  8022. memset(&packet1, 0, sizeof(packet1));
  8023. packet1.arming_time_utc = packet_in.arming_time_utc;
  8024. packet1.takeoff_time_utc = packet_in.takeoff_time_utc;
  8025. packet1.flight_uuid = packet_in.flight_uuid;
  8026. packet1.time_boot_ms = packet_in.time_boot_ms;
  8027. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  8028. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  8029. // cope with extensions
  8030. memset(MAVLINK_MSG_ID_FLIGHT_INFORMATION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_FLIGHT_INFORMATION_MIN_LEN);
  8031. }
  8032. #endif
  8033. memset(&packet2, 0, sizeof(packet2));
  8034. mavlink_msg_flight_information_encode(system_id, component_id, &msg, &packet1);
  8035. mavlink_msg_flight_information_decode(&msg, &packet2);
  8036. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8037. memset(&packet2, 0, sizeof(packet2));
  8038. mavlink_msg_flight_information_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.arming_time_utc , packet1.takeoff_time_utc , packet1.flight_uuid );
  8039. mavlink_msg_flight_information_decode(&msg, &packet2);
  8040. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8041. memset(&packet2, 0, sizeof(packet2));
  8042. mavlink_msg_flight_information_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.arming_time_utc , packet1.takeoff_time_utc , packet1.flight_uuid );
  8043. mavlink_msg_flight_information_decode(&msg, &packet2);
  8044. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8045. memset(&packet2, 0, sizeof(packet2));
  8046. mavlink_msg_to_send_buffer(buffer, &msg);
  8047. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  8048. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  8049. }
  8050. mavlink_msg_flight_information_decode(last_msg, &packet2);
  8051. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8052. memset(&packet2, 0, sizeof(packet2));
  8053. mavlink_msg_flight_information_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.arming_time_utc , packet1.takeoff_time_utc , packet1.flight_uuid );
  8054. mavlink_msg_flight_information_decode(last_msg, &packet2);
  8055. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8056. }
  8057. static void mavlink_test_mount_orientation(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  8058. {
  8059. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  8060. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  8061. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MOUNT_ORIENTATION >= 256) {
  8062. return;
  8063. }
  8064. #endif
  8065. mavlink_message_t msg;
  8066. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  8067. uint16_t i;
  8068. mavlink_mount_orientation_t packet_in = {
  8069. 963497464,45.0,73.0,101.0,129.0
  8070. };
  8071. mavlink_mount_orientation_t packet1, packet2;
  8072. memset(&packet1, 0, sizeof(packet1));
  8073. packet1.time_boot_ms = packet_in.time_boot_ms;
  8074. packet1.roll = packet_in.roll;
  8075. packet1.pitch = packet_in.pitch;
  8076. packet1.yaw = packet_in.yaw;
  8077. packet1.yaw_absolute = packet_in.yaw_absolute;
  8078. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  8079. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  8080. // cope with extensions
  8081. memset(MAVLINK_MSG_ID_MOUNT_ORIENTATION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MOUNT_ORIENTATION_MIN_LEN);
  8082. }
  8083. #endif
  8084. memset(&packet2, 0, sizeof(packet2));
  8085. mavlink_msg_mount_orientation_encode(system_id, component_id, &msg, &packet1);
  8086. mavlink_msg_mount_orientation_decode(&msg, &packet2);
  8087. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8088. memset(&packet2, 0, sizeof(packet2));
  8089. mavlink_msg_mount_orientation_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.roll , packet1.pitch , packet1.yaw , packet1.yaw_absolute );
  8090. mavlink_msg_mount_orientation_decode(&msg, &packet2);
  8091. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8092. memset(&packet2, 0, sizeof(packet2));
  8093. mavlink_msg_mount_orientation_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.roll , packet1.pitch , packet1.yaw , packet1.yaw_absolute );
  8094. mavlink_msg_mount_orientation_decode(&msg, &packet2);
  8095. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8096. memset(&packet2, 0, sizeof(packet2));
  8097. mavlink_msg_to_send_buffer(buffer, &msg);
  8098. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  8099. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  8100. }
  8101. mavlink_msg_mount_orientation_decode(last_msg, &packet2);
  8102. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8103. memset(&packet2, 0, sizeof(packet2));
  8104. mavlink_msg_mount_orientation_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.roll , packet1.pitch , packet1.yaw , packet1.yaw_absolute );
  8105. mavlink_msg_mount_orientation_decode(last_msg, &packet2);
  8106. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8107. }
  8108. static void mavlink_test_logging_data(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  8109. {
  8110. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  8111. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  8112. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_LOGGING_DATA >= 256) {
  8113. return;
  8114. }
  8115. #endif
  8116. mavlink_message_t msg;
  8117. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  8118. uint16_t i;
  8119. mavlink_logging_data_t packet_in = {
  8120. 17235,139,206,17,84,{ 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143 }
  8121. };
  8122. mavlink_logging_data_t packet1, packet2;
  8123. memset(&packet1, 0, sizeof(packet1));
  8124. packet1.sequence = packet_in.sequence;
  8125. packet1.target_system = packet_in.target_system;
  8126. packet1.target_component = packet_in.target_component;
  8127. packet1.length = packet_in.length;
  8128. packet1.first_message_offset = packet_in.first_message_offset;
  8129. mav_array_memcpy(packet1.data, packet_in.data, sizeof(uint8_t)*249);
  8130. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  8131. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  8132. // cope with extensions
  8133. memset(MAVLINK_MSG_ID_LOGGING_DATA_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_LOGGING_DATA_MIN_LEN);
  8134. }
  8135. #endif
  8136. memset(&packet2, 0, sizeof(packet2));
  8137. mavlink_msg_logging_data_encode(system_id, component_id, &msg, &packet1);
  8138. mavlink_msg_logging_data_decode(&msg, &packet2);
  8139. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8140. memset(&packet2, 0, sizeof(packet2));
  8141. mavlink_msg_logging_data_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.sequence , packet1.length , packet1.first_message_offset , packet1.data );
  8142. mavlink_msg_logging_data_decode(&msg, &packet2);
  8143. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8144. memset(&packet2, 0, sizeof(packet2));
  8145. mavlink_msg_logging_data_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.sequence , packet1.length , packet1.first_message_offset , packet1.data );
  8146. mavlink_msg_logging_data_decode(&msg, &packet2);
  8147. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8148. memset(&packet2, 0, sizeof(packet2));
  8149. mavlink_msg_to_send_buffer(buffer, &msg);
  8150. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  8151. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  8152. }
  8153. mavlink_msg_logging_data_decode(last_msg, &packet2);
  8154. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8155. memset(&packet2, 0, sizeof(packet2));
  8156. mavlink_msg_logging_data_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.sequence , packet1.length , packet1.first_message_offset , packet1.data );
  8157. mavlink_msg_logging_data_decode(last_msg, &packet2);
  8158. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8159. }
  8160. static void mavlink_test_logging_data_acked(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  8161. {
  8162. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  8163. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  8164. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_LOGGING_DATA_ACKED >= 256) {
  8165. return;
  8166. }
  8167. #endif
  8168. mavlink_message_t msg;
  8169. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  8170. uint16_t i;
  8171. mavlink_logging_data_acked_t packet_in = {
  8172. 17235,139,206,17,84,{ 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143 }
  8173. };
  8174. mavlink_logging_data_acked_t packet1, packet2;
  8175. memset(&packet1, 0, sizeof(packet1));
  8176. packet1.sequence = packet_in.sequence;
  8177. packet1.target_system = packet_in.target_system;
  8178. packet1.target_component = packet_in.target_component;
  8179. packet1.length = packet_in.length;
  8180. packet1.first_message_offset = packet_in.first_message_offset;
  8181. mav_array_memcpy(packet1.data, packet_in.data, sizeof(uint8_t)*249);
  8182. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  8183. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  8184. // cope with extensions
  8185. memset(MAVLINK_MSG_ID_LOGGING_DATA_ACKED_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_LOGGING_DATA_ACKED_MIN_LEN);
  8186. }
  8187. #endif
  8188. memset(&packet2, 0, sizeof(packet2));
  8189. mavlink_msg_logging_data_acked_encode(system_id, component_id, &msg, &packet1);
  8190. mavlink_msg_logging_data_acked_decode(&msg, &packet2);
  8191. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8192. memset(&packet2, 0, sizeof(packet2));
  8193. mavlink_msg_logging_data_acked_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.sequence , packet1.length , packet1.first_message_offset , packet1.data );
  8194. mavlink_msg_logging_data_acked_decode(&msg, &packet2);
  8195. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8196. memset(&packet2, 0, sizeof(packet2));
  8197. mavlink_msg_logging_data_acked_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.sequence , packet1.length , packet1.first_message_offset , packet1.data );
  8198. mavlink_msg_logging_data_acked_decode(&msg, &packet2);
  8199. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8200. memset(&packet2, 0, sizeof(packet2));
  8201. mavlink_msg_to_send_buffer(buffer, &msg);
  8202. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  8203. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  8204. }
  8205. mavlink_msg_logging_data_acked_decode(last_msg, &packet2);
  8206. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8207. memset(&packet2, 0, sizeof(packet2));
  8208. mavlink_msg_logging_data_acked_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.sequence , packet1.length , packet1.first_message_offset , packet1.data );
  8209. mavlink_msg_logging_data_acked_decode(last_msg, &packet2);
  8210. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8211. }
  8212. static void mavlink_test_logging_ack(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  8213. {
  8214. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  8215. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  8216. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_LOGGING_ACK >= 256) {
  8217. return;
  8218. }
  8219. #endif
  8220. mavlink_message_t msg;
  8221. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  8222. uint16_t i;
  8223. mavlink_logging_ack_t packet_in = {
  8224. 17235,139,206
  8225. };
  8226. mavlink_logging_ack_t packet1, packet2;
  8227. memset(&packet1, 0, sizeof(packet1));
  8228. packet1.sequence = packet_in.sequence;
  8229. packet1.target_system = packet_in.target_system;
  8230. packet1.target_component = packet_in.target_component;
  8231. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  8232. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  8233. // cope with extensions
  8234. memset(MAVLINK_MSG_ID_LOGGING_ACK_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_LOGGING_ACK_MIN_LEN);
  8235. }
  8236. #endif
  8237. memset(&packet2, 0, sizeof(packet2));
  8238. mavlink_msg_logging_ack_encode(system_id, component_id, &msg, &packet1);
  8239. mavlink_msg_logging_ack_decode(&msg, &packet2);
  8240. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8241. memset(&packet2, 0, sizeof(packet2));
  8242. mavlink_msg_logging_ack_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.sequence );
  8243. mavlink_msg_logging_ack_decode(&msg, &packet2);
  8244. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8245. memset(&packet2, 0, sizeof(packet2));
  8246. mavlink_msg_logging_ack_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.sequence );
  8247. mavlink_msg_logging_ack_decode(&msg, &packet2);
  8248. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8249. memset(&packet2, 0, sizeof(packet2));
  8250. mavlink_msg_to_send_buffer(buffer, &msg);
  8251. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  8252. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  8253. }
  8254. mavlink_msg_logging_ack_decode(last_msg, &packet2);
  8255. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8256. memset(&packet2, 0, sizeof(packet2));
  8257. mavlink_msg_logging_ack_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.sequence );
  8258. mavlink_msg_logging_ack_decode(last_msg, &packet2);
  8259. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8260. }
  8261. static void mavlink_test_video_stream_information(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  8262. {
  8263. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  8264. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  8265. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION >= 256) {
  8266. return;
  8267. }
  8268. #endif
  8269. mavlink_message_t msg;
  8270. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  8271. uint16_t i;
  8272. mavlink_video_stream_information_t packet_in = {
  8273. 17.0,963497672,17651,17755,17859,17963,18067,187,254,65,"VWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ","BCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCD"
  8274. };
  8275. mavlink_video_stream_information_t packet1, packet2;
  8276. memset(&packet1, 0, sizeof(packet1));
  8277. packet1.framerate = packet_in.framerate;
  8278. packet1.bitrate = packet_in.bitrate;
  8279. packet1.flags = packet_in.flags;
  8280. packet1.resolution_h = packet_in.resolution_h;
  8281. packet1.resolution_v = packet_in.resolution_v;
  8282. packet1.rotation = packet_in.rotation;
  8283. packet1.hfov = packet_in.hfov;
  8284. packet1.stream_id = packet_in.stream_id;
  8285. packet1.count = packet_in.count;
  8286. packet1.type = packet_in.type;
  8287. mav_array_memcpy(packet1.name, packet_in.name, sizeof(char)*32);
  8288. mav_array_memcpy(packet1.uri, packet_in.uri, sizeof(char)*160);
  8289. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  8290. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  8291. // cope with extensions
  8292. memset(MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_MIN_LEN);
  8293. }
  8294. #endif
  8295. memset(&packet2, 0, sizeof(packet2));
  8296. mavlink_msg_video_stream_information_encode(system_id, component_id, &msg, &packet1);
  8297. mavlink_msg_video_stream_information_decode(&msg, &packet2);
  8298. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8299. memset(&packet2, 0, sizeof(packet2));
  8300. mavlink_msg_video_stream_information_pack(system_id, component_id, &msg , packet1.stream_id , packet1.count , packet1.type , packet1.flags , packet1.framerate , packet1.resolution_h , packet1.resolution_v , packet1.bitrate , packet1.rotation , packet1.hfov , packet1.name , packet1.uri );
  8301. mavlink_msg_video_stream_information_decode(&msg, &packet2);
  8302. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8303. memset(&packet2, 0, sizeof(packet2));
  8304. mavlink_msg_video_stream_information_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.stream_id , packet1.count , packet1.type , packet1.flags , packet1.framerate , packet1.resolution_h , packet1.resolution_v , packet1.bitrate , packet1.rotation , packet1.hfov , packet1.name , packet1.uri );
  8305. mavlink_msg_video_stream_information_decode(&msg, &packet2);
  8306. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8307. memset(&packet2, 0, sizeof(packet2));
  8308. mavlink_msg_to_send_buffer(buffer, &msg);
  8309. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  8310. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  8311. }
  8312. mavlink_msg_video_stream_information_decode(last_msg, &packet2);
  8313. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8314. memset(&packet2, 0, sizeof(packet2));
  8315. mavlink_msg_video_stream_information_send(MAVLINK_COMM_1 , packet1.stream_id , packet1.count , packet1.type , packet1.flags , packet1.framerate , packet1.resolution_h , packet1.resolution_v , packet1.bitrate , packet1.rotation , packet1.hfov , packet1.name , packet1.uri );
  8316. mavlink_msg_video_stream_information_decode(last_msg, &packet2);
  8317. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8318. }
  8319. static void mavlink_test_video_stream_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  8320. {
  8321. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  8322. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  8323. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_VIDEO_STREAM_STATUS >= 256) {
  8324. return;
  8325. }
  8326. #endif
  8327. mavlink_message_t msg;
  8328. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  8329. uint16_t i;
  8330. mavlink_video_stream_status_t packet_in = {
  8331. 17.0,963497672,17651,17755,17859,17963,18067,187
  8332. };
  8333. mavlink_video_stream_status_t packet1, packet2;
  8334. memset(&packet1, 0, sizeof(packet1));
  8335. packet1.framerate = packet_in.framerate;
  8336. packet1.bitrate = packet_in.bitrate;
  8337. packet1.flags = packet_in.flags;
  8338. packet1.resolution_h = packet_in.resolution_h;
  8339. packet1.resolution_v = packet_in.resolution_v;
  8340. packet1.rotation = packet_in.rotation;
  8341. packet1.hfov = packet_in.hfov;
  8342. packet1.stream_id = packet_in.stream_id;
  8343. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  8344. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  8345. // cope with extensions
  8346. memset(MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_MIN_LEN);
  8347. }
  8348. #endif
  8349. memset(&packet2, 0, sizeof(packet2));
  8350. mavlink_msg_video_stream_status_encode(system_id, component_id, &msg, &packet1);
  8351. mavlink_msg_video_stream_status_decode(&msg, &packet2);
  8352. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8353. memset(&packet2, 0, sizeof(packet2));
  8354. mavlink_msg_video_stream_status_pack(system_id, component_id, &msg , packet1.stream_id , packet1.flags , packet1.framerate , packet1.resolution_h , packet1.resolution_v , packet1.bitrate , packet1.rotation , packet1.hfov );
  8355. mavlink_msg_video_stream_status_decode(&msg, &packet2);
  8356. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8357. memset(&packet2, 0, sizeof(packet2));
  8358. mavlink_msg_video_stream_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.stream_id , packet1.flags , packet1.framerate , packet1.resolution_h , packet1.resolution_v , packet1.bitrate , packet1.rotation , packet1.hfov );
  8359. mavlink_msg_video_stream_status_decode(&msg, &packet2);
  8360. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8361. memset(&packet2, 0, sizeof(packet2));
  8362. mavlink_msg_to_send_buffer(buffer, &msg);
  8363. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  8364. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  8365. }
  8366. mavlink_msg_video_stream_status_decode(last_msg, &packet2);
  8367. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8368. memset(&packet2, 0, sizeof(packet2));
  8369. mavlink_msg_video_stream_status_send(MAVLINK_COMM_1 , packet1.stream_id , packet1.flags , packet1.framerate , packet1.resolution_h , packet1.resolution_v , packet1.bitrate , packet1.rotation , packet1.hfov );
  8370. mavlink_msg_video_stream_status_decode(last_msg, &packet2);
  8371. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8372. }
  8373. static void mavlink_test_wifi_config_ap(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  8374. {
  8375. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  8376. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  8377. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_WIFI_CONFIG_AP >= 256) {
  8378. return;
  8379. }
  8380. #endif
  8381. mavlink_message_t msg;
  8382. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  8383. uint16_t i;
  8384. mavlink_wifi_config_ap_t packet_in = {
  8385. "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDE","GHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQ"
  8386. };
  8387. mavlink_wifi_config_ap_t packet1, packet2;
  8388. memset(&packet1, 0, sizeof(packet1));
  8389. mav_array_memcpy(packet1.ssid, packet_in.ssid, sizeof(char)*32);
  8390. mav_array_memcpy(packet1.password, packet_in.password, sizeof(char)*64);
  8391. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  8392. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  8393. // cope with extensions
  8394. memset(MAVLINK_MSG_ID_WIFI_CONFIG_AP_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_WIFI_CONFIG_AP_MIN_LEN);
  8395. }
  8396. #endif
  8397. memset(&packet2, 0, sizeof(packet2));
  8398. mavlink_msg_wifi_config_ap_encode(system_id, component_id, &msg, &packet1);
  8399. mavlink_msg_wifi_config_ap_decode(&msg, &packet2);
  8400. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8401. memset(&packet2, 0, sizeof(packet2));
  8402. mavlink_msg_wifi_config_ap_pack(system_id, component_id, &msg , packet1.ssid , packet1.password );
  8403. mavlink_msg_wifi_config_ap_decode(&msg, &packet2);
  8404. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8405. memset(&packet2, 0, sizeof(packet2));
  8406. mavlink_msg_wifi_config_ap_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.ssid , packet1.password );
  8407. mavlink_msg_wifi_config_ap_decode(&msg, &packet2);
  8408. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8409. memset(&packet2, 0, sizeof(packet2));
  8410. mavlink_msg_to_send_buffer(buffer, &msg);
  8411. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  8412. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  8413. }
  8414. mavlink_msg_wifi_config_ap_decode(last_msg, &packet2);
  8415. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8416. memset(&packet2, 0, sizeof(packet2));
  8417. mavlink_msg_wifi_config_ap_send(MAVLINK_COMM_1 , packet1.ssid , packet1.password );
  8418. mavlink_msg_wifi_config_ap_decode(last_msg, &packet2);
  8419. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8420. }
  8421. static void mavlink_test_protocol_version(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  8422. {
  8423. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  8424. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  8425. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_PROTOCOL_VERSION >= 256) {
  8426. return;
  8427. }
  8428. #endif
  8429. mavlink_message_t msg;
  8430. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  8431. uint16_t i;
  8432. mavlink_protocol_version_t packet_in = {
  8433. 17235,17339,17443,{ 151, 152, 153, 154, 155, 156, 157, 158 },{ 175, 176, 177, 178, 179, 180, 181, 182 }
  8434. };
  8435. mavlink_protocol_version_t packet1, packet2;
  8436. memset(&packet1, 0, sizeof(packet1));
  8437. packet1.version = packet_in.version;
  8438. packet1.min_version = packet_in.min_version;
  8439. packet1.max_version = packet_in.max_version;
  8440. mav_array_memcpy(packet1.spec_version_hash, packet_in.spec_version_hash, sizeof(uint8_t)*8);
  8441. mav_array_memcpy(packet1.library_version_hash, packet_in.library_version_hash, sizeof(uint8_t)*8);
  8442. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  8443. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  8444. // cope with extensions
  8445. memset(MAVLINK_MSG_ID_PROTOCOL_VERSION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_PROTOCOL_VERSION_MIN_LEN);
  8446. }
  8447. #endif
  8448. memset(&packet2, 0, sizeof(packet2));
  8449. mavlink_msg_protocol_version_encode(system_id, component_id, &msg, &packet1);
  8450. mavlink_msg_protocol_version_decode(&msg, &packet2);
  8451. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8452. memset(&packet2, 0, sizeof(packet2));
  8453. mavlink_msg_protocol_version_pack(system_id, component_id, &msg , packet1.version , packet1.min_version , packet1.max_version , packet1.spec_version_hash , packet1.library_version_hash );
  8454. mavlink_msg_protocol_version_decode(&msg, &packet2);
  8455. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8456. memset(&packet2, 0, sizeof(packet2));
  8457. mavlink_msg_protocol_version_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.version , packet1.min_version , packet1.max_version , packet1.spec_version_hash , packet1.library_version_hash );
  8458. mavlink_msg_protocol_version_decode(&msg, &packet2);
  8459. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8460. memset(&packet2, 0, sizeof(packet2));
  8461. mavlink_msg_to_send_buffer(buffer, &msg);
  8462. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  8463. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  8464. }
  8465. mavlink_msg_protocol_version_decode(last_msg, &packet2);
  8466. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8467. memset(&packet2, 0, sizeof(packet2));
  8468. mavlink_msg_protocol_version_send(MAVLINK_COMM_1 , packet1.version , packet1.min_version , packet1.max_version , packet1.spec_version_hash , packet1.library_version_hash );
  8469. mavlink_msg_protocol_version_decode(last_msg, &packet2);
  8470. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8471. }
  8472. static void mavlink_test_uavcan_node_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  8473. {
  8474. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  8475. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  8476. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_UAVCAN_NODE_STATUS >= 256) {
  8477. return;
  8478. }
  8479. #endif
  8480. mavlink_message_t msg;
  8481. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  8482. uint16_t i;
  8483. mavlink_uavcan_node_status_t packet_in = {
  8484. 93372036854775807ULL,963497880,17859,175,242,53
  8485. };
  8486. mavlink_uavcan_node_status_t packet1, packet2;
  8487. memset(&packet1, 0, sizeof(packet1));
  8488. packet1.time_usec = packet_in.time_usec;
  8489. packet1.uptime_sec = packet_in.uptime_sec;
  8490. packet1.vendor_specific_status_code = packet_in.vendor_specific_status_code;
  8491. packet1.health = packet_in.health;
  8492. packet1.mode = packet_in.mode;
  8493. packet1.sub_mode = packet_in.sub_mode;
  8494. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  8495. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  8496. // cope with extensions
  8497. memset(MAVLINK_MSG_ID_UAVCAN_NODE_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_UAVCAN_NODE_STATUS_MIN_LEN);
  8498. }
  8499. #endif
  8500. memset(&packet2, 0, sizeof(packet2));
  8501. mavlink_msg_uavcan_node_status_encode(system_id, component_id, &msg, &packet1);
  8502. mavlink_msg_uavcan_node_status_decode(&msg, &packet2);
  8503. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8504. memset(&packet2, 0, sizeof(packet2));
  8505. mavlink_msg_uavcan_node_status_pack(system_id, component_id, &msg , packet1.time_usec , packet1.uptime_sec , packet1.health , packet1.mode , packet1.sub_mode , packet1.vendor_specific_status_code );
  8506. mavlink_msg_uavcan_node_status_decode(&msg, &packet2);
  8507. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8508. memset(&packet2, 0, sizeof(packet2));
  8509. mavlink_msg_uavcan_node_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.uptime_sec , packet1.health , packet1.mode , packet1.sub_mode , packet1.vendor_specific_status_code );
  8510. mavlink_msg_uavcan_node_status_decode(&msg, &packet2);
  8511. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8512. memset(&packet2, 0, sizeof(packet2));
  8513. mavlink_msg_to_send_buffer(buffer, &msg);
  8514. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  8515. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  8516. }
  8517. mavlink_msg_uavcan_node_status_decode(last_msg, &packet2);
  8518. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8519. memset(&packet2, 0, sizeof(packet2));
  8520. mavlink_msg_uavcan_node_status_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.uptime_sec , packet1.health , packet1.mode , packet1.sub_mode , packet1.vendor_specific_status_code );
  8521. mavlink_msg_uavcan_node_status_decode(last_msg, &packet2);
  8522. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8523. }
  8524. static void mavlink_test_uavcan_node_info(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  8525. {
  8526. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  8527. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  8528. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_UAVCAN_NODE_INFO >= 256) {
  8529. return;
  8530. }
  8531. #endif
  8532. mavlink_message_t msg;
  8533. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  8534. uint16_t i;
  8535. mavlink_uavcan_node_info_t packet_in = {
  8536. 93372036854775807ULL,963497880,963498088,"QRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQ",37,104,{ 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186 },219,30
  8537. };
  8538. mavlink_uavcan_node_info_t packet1, packet2;
  8539. memset(&packet1, 0, sizeof(packet1));
  8540. packet1.time_usec = packet_in.time_usec;
  8541. packet1.uptime_sec = packet_in.uptime_sec;
  8542. packet1.sw_vcs_commit = packet_in.sw_vcs_commit;
  8543. packet1.hw_version_major = packet_in.hw_version_major;
  8544. packet1.hw_version_minor = packet_in.hw_version_minor;
  8545. packet1.sw_version_major = packet_in.sw_version_major;
  8546. packet1.sw_version_minor = packet_in.sw_version_minor;
  8547. mav_array_memcpy(packet1.name, packet_in.name, sizeof(char)*80);
  8548. mav_array_memcpy(packet1.hw_unique_id, packet_in.hw_unique_id, sizeof(uint8_t)*16);
  8549. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  8550. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  8551. // cope with extensions
  8552. memset(MAVLINK_MSG_ID_UAVCAN_NODE_INFO_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_UAVCAN_NODE_INFO_MIN_LEN);
  8553. }
  8554. #endif
  8555. memset(&packet2, 0, sizeof(packet2));
  8556. mavlink_msg_uavcan_node_info_encode(system_id, component_id, &msg, &packet1);
  8557. mavlink_msg_uavcan_node_info_decode(&msg, &packet2);
  8558. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8559. memset(&packet2, 0, sizeof(packet2));
  8560. mavlink_msg_uavcan_node_info_pack(system_id, component_id, &msg , packet1.time_usec , packet1.uptime_sec , packet1.name , packet1.hw_version_major , packet1.hw_version_minor , packet1.hw_unique_id , packet1.sw_version_major , packet1.sw_version_minor , packet1.sw_vcs_commit );
  8561. mavlink_msg_uavcan_node_info_decode(&msg, &packet2);
  8562. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8563. memset(&packet2, 0, sizeof(packet2));
  8564. mavlink_msg_uavcan_node_info_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.uptime_sec , packet1.name , packet1.hw_version_major , packet1.hw_version_minor , packet1.hw_unique_id , packet1.sw_version_major , packet1.sw_version_minor , packet1.sw_vcs_commit );
  8565. mavlink_msg_uavcan_node_info_decode(&msg, &packet2);
  8566. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8567. memset(&packet2, 0, sizeof(packet2));
  8568. mavlink_msg_to_send_buffer(buffer, &msg);
  8569. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  8570. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  8571. }
  8572. mavlink_msg_uavcan_node_info_decode(last_msg, &packet2);
  8573. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8574. memset(&packet2, 0, sizeof(packet2));
  8575. mavlink_msg_uavcan_node_info_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.uptime_sec , packet1.name , packet1.hw_version_major , packet1.hw_version_minor , packet1.hw_unique_id , packet1.sw_version_major , packet1.sw_version_minor , packet1.sw_vcs_commit );
  8576. mavlink_msg_uavcan_node_info_decode(last_msg, &packet2);
  8577. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8578. }
  8579. static void mavlink_test_param_ext_request_read(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  8580. {
  8581. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  8582. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  8583. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_PARAM_EXT_REQUEST_READ >= 256) {
  8584. return;
  8585. }
  8586. #endif
  8587. mavlink_message_t msg;
  8588. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  8589. uint16_t i;
  8590. mavlink_param_ext_request_read_t packet_in = {
  8591. 17235,139,206,"EFGHIJKLMNOPQRS"
  8592. };
  8593. mavlink_param_ext_request_read_t packet1, packet2;
  8594. memset(&packet1, 0, sizeof(packet1));
  8595. packet1.param_index = packet_in.param_index;
  8596. packet1.target_system = packet_in.target_system;
  8597. packet1.target_component = packet_in.target_component;
  8598. mav_array_memcpy(packet1.param_id, packet_in.param_id, sizeof(char)*16);
  8599. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  8600. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  8601. // cope with extensions
  8602. memset(MAVLINK_MSG_ID_PARAM_EXT_REQUEST_READ_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_PARAM_EXT_REQUEST_READ_MIN_LEN);
  8603. }
  8604. #endif
  8605. memset(&packet2, 0, sizeof(packet2));
  8606. mavlink_msg_param_ext_request_read_encode(system_id, component_id, &msg, &packet1);
  8607. mavlink_msg_param_ext_request_read_decode(&msg, &packet2);
  8608. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8609. memset(&packet2, 0, sizeof(packet2));
  8610. mavlink_msg_param_ext_request_read_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.param_id , packet1.param_index );
  8611. mavlink_msg_param_ext_request_read_decode(&msg, &packet2);
  8612. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8613. memset(&packet2, 0, sizeof(packet2));
  8614. mavlink_msg_param_ext_request_read_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.param_id , packet1.param_index );
  8615. mavlink_msg_param_ext_request_read_decode(&msg, &packet2);
  8616. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8617. memset(&packet2, 0, sizeof(packet2));
  8618. mavlink_msg_to_send_buffer(buffer, &msg);
  8619. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  8620. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  8621. }
  8622. mavlink_msg_param_ext_request_read_decode(last_msg, &packet2);
  8623. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8624. memset(&packet2, 0, sizeof(packet2));
  8625. mavlink_msg_param_ext_request_read_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.param_id , packet1.param_index );
  8626. mavlink_msg_param_ext_request_read_decode(last_msg, &packet2);
  8627. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8628. }
  8629. static void mavlink_test_param_ext_request_list(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  8630. {
  8631. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  8632. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  8633. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_PARAM_EXT_REQUEST_LIST >= 256) {
  8634. return;
  8635. }
  8636. #endif
  8637. mavlink_message_t msg;
  8638. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  8639. uint16_t i;
  8640. mavlink_param_ext_request_list_t packet_in = {
  8641. 5,72
  8642. };
  8643. mavlink_param_ext_request_list_t packet1, packet2;
  8644. memset(&packet1, 0, sizeof(packet1));
  8645. packet1.target_system = packet_in.target_system;
  8646. packet1.target_component = packet_in.target_component;
  8647. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  8648. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  8649. // cope with extensions
  8650. memset(MAVLINK_MSG_ID_PARAM_EXT_REQUEST_LIST_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_PARAM_EXT_REQUEST_LIST_MIN_LEN);
  8651. }
  8652. #endif
  8653. memset(&packet2, 0, sizeof(packet2));
  8654. mavlink_msg_param_ext_request_list_encode(system_id, component_id, &msg, &packet1);
  8655. mavlink_msg_param_ext_request_list_decode(&msg, &packet2);
  8656. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8657. memset(&packet2, 0, sizeof(packet2));
  8658. mavlink_msg_param_ext_request_list_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component );
  8659. mavlink_msg_param_ext_request_list_decode(&msg, &packet2);
  8660. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8661. memset(&packet2, 0, sizeof(packet2));
  8662. mavlink_msg_param_ext_request_list_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component );
  8663. mavlink_msg_param_ext_request_list_decode(&msg, &packet2);
  8664. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8665. memset(&packet2, 0, sizeof(packet2));
  8666. mavlink_msg_to_send_buffer(buffer, &msg);
  8667. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  8668. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  8669. }
  8670. mavlink_msg_param_ext_request_list_decode(last_msg, &packet2);
  8671. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8672. memset(&packet2, 0, sizeof(packet2));
  8673. mavlink_msg_param_ext_request_list_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component );
  8674. mavlink_msg_param_ext_request_list_decode(last_msg, &packet2);
  8675. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8676. }
  8677. static void mavlink_test_param_ext_value(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  8678. {
  8679. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  8680. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  8681. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_PARAM_EXT_VALUE >= 256) {
  8682. return;
  8683. }
  8684. #endif
  8685. mavlink_message_t msg;
  8686. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  8687. uint16_t i;
  8688. mavlink_param_ext_value_t packet_in = {
  8689. 17235,17339,"EFGHIJKLMNOPQRS","UVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQ",193
  8690. };
  8691. mavlink_param_ext_value_t packet1, packet2;
  8692. memset(&packet1, 0, sizeof(packet1));
  8693. packet1.param_count = packet_in.param_count;
  8694. packet1.param_index = packet_in.param_index;
  8695. packet1.param_type = packet_in.param_type;
  8696. mav_array_memcpy(packet1.param_id, packet_in.param_id, sizeof(char)*16);
  8697. mav_array_memcpy(packet1.param_value, packet_in.param_value, sizeof(char)*128);
  8698. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  8699. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  8700. // cope with extensions
  8701. memset(MAVLINK_MSG_ID_PARAM_EXT_VALUE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_PARAM_EXT_VALUE_MIN_LEN);
  8702. }
  8703. #endif
  8704. memset(&packet2, 0, sizeof(packet2));
  8705. mavlink_msg_param_ext_value_encode(system_id, component_id, &msg, &packet1);
  8706. mavlink_msg_param_ext_value_decode(&msg, &packet2);
  8707. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8708. memset(&packet2, 0, sizeof(packet2));
  8709. mavlink_msg_param_ext_value_pack(system_id, component_id, &msg , packet1.param_id , packet1.param_value , packet1.param_type , packet1.param_count , packet1.param_index );
  8710. mavlink_msg_param_ext_value_decode(&msg, &packet2);
  8711. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8712. memset(&packet2, 0, sizeof(packet2));
  8713. mavlink_msg_param_ext_value_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.param_id , packet1.param_value , packet1.param_type , packet1.param_count , packet1.param_index );
  8714. mavlink_msg_param_ext_value_decode(&msg, &packet2);
  8715. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8716. memset(&packet2, 0, sizeof(packet2));
  8717. mavlink_msg_to_send_buffer(buffer, &msg);
  8718. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  8719. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  8720. }
  8721. mavlink_msg_param_ext_value_decode(last_msg, &packet2);
  8722. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8723. memset(&packet2, 0, sizeof(packet2));
  8724. mavlink_msg_param_ext_value_send(MAVLINK_COMM_1 , packet1.param_id , packet1.param_value , packet1.param_type , packet1.param_count , packet1.param_index );
  8725. mavlink_msg_param_ext_value_decode(last_msg, &packet2);
  8726. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8727. }
  8728. static void mavlink_test_param_ext_set(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  8729. {
  8730. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  8731. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  8732. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_PARAM_EXT_SET >= 256) {
  8733. return;
  8734. }
  8735. #endif
  8736. mavlink_message_t msg;
  8737. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  8738. uint16_t i;
  8739. mavlink_param_ext_set_t packet_in = {
  8740. 5,72,"CDEFGHIJKLMNOPQ","STUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNO",59
  8741. };
  8742. mavlink_param_ext_set_t packet1, packet2;
  8743. memset(&packet1, 0, sizeof(packet1));
  8744. packet1.target_system = packet_in.target_system;
  8745. packet1.target_component = packet_in.target_component;
  8746. packet1.param_type = packet_in.param_type;
  8747. mav_array_memcpy(packet1.param_id, packet_in.param_id, sizeof(char)*16);
  8748. mav_array_memcpy(packet1.param_value, packet_in.param_value, sizeof(char)*128);
  8749. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  8750. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  8751. // cope with extensions
  8752. memset(MAVLINK_MSG_ID_PARAM_EXT_SET_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_PARAM_EXT_SET_MIN_LEN);
  8753. }
  8754. #endif
  8755. memset(&packet2, 0, sizeof(packet2));
  8756. mavlink_msg_param_ext_set_encode(system_id, component_id, &msg, &packet1);
  8757. mavlink_msg_param_ext_set_decode(&msg, &packet2);
  8758. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8759. memset(&packet2, 0, sizeof(packet2));
  8760. mavlink_msg_param_ext_set_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.param_id , packet1.param_value , packet1.param_type );
  8761. mavlink_msg_param_ext_set_decode(&msg, &packet2);
  8762. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8763. memset(&packet2, 0, sizeof(packet2));
  8764. mavlink_msg_param_ext_set_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.param_id , packet1.param_value , packet1.param_type );
  8765. mavlink_msg_param_ext_set_decode(&msg, &packet2);
  8766. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8767. memset(&packet2, 0, sizeof(packet2));
  8768. mavlink_msg_to_send_buffer(buffer, &msg);
  8769. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  8770. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  8771. }
  8772. mavlink_msg_param_ext_set_decode(last_msg, &packet2);
  8773. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8774. memset(&packet2, 0, sizeof(packet2));
  8775. mavlink_msg_param_ext_set_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.param_id , packet1.param_value , packet1.param_type );
  8776. mavlink_msg_param_ext_set_decode(last_msg, &packet2);
  8777. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8778. }
  8779. static void mavlink_test_param_ext_ack(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  8780. {
  8781. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  8782. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  8783. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_PARAM_EXT_ACK >= 256) {
  8784. return;
  8785. }
  8786. #endif
  8787. mavlink_message_t msg;
  8788. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  8789. uint16_t i;
  8790. mavlink_param_ext_ack_t packet_in = {
  8791. "ABCDEFGHIJKLMNO","QRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLM",181,248
  8792. };
  8793. mavlink_param_ext_ack_t packet1, packet2;
  8794. memset(&packet1, 0, sizeof(packet1));
  8795. packet1.param_type = packet_in.param_type;
  8796. packet1.param_result = packet_in.param_result;
  8797. mav_array_memcpy(packet1.param_id, packet_in.param_id, sizeof(char)*16);
  8798. mav_array_memcpy(packet1.param_value, packet_in.param_value, sizeof(char)*128);
  8799. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  8800. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  8801. // cope with extensions
  8802. memset(MAVLINK_MSG_ID_PARAM_EXT_ACK_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_PARAM_EXT_ACK_MIN_LEN);
  8803. }
  8804. #endif
  8805. memset(&packet2, 0, sizeof(packet2));
  8806. mavlink_msg_param_ext_ack_encode(system_id, component_id, &msg, &packet1);
  8807. mavlink_msg_param_ext_ack_decode(&msg, &packet2);
  8808. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8809. memset(&packet2, 0, sizeof(packet2));
  8810. mavlink_msg_param_ext_ack_pack(system_id, component_id, &msg , packet1.param_id , packet1.param_value , packet1.param_type , packet1.param_result );
  8811. mavlink_msg_param_ext_ack_decode(&msg, &packet2);
  8812. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8813. memset(&packet2, 0, sizeof(packet2));
  8814. mavlink_msg_param_ext_ack_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.param_id , packet1.param_value , packet1.param_type , packet1.param_result );
  8815. mavlink_msg_param_ext_ack_decode(&msg, &packet2);
  8816. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8817. memset(&packet2, 0, sizeof(packet2));
  8818. mavlink_msg_to_send_buffer(buffer, &msg);
  8819. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  8820. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  8821. }
  8822. mavlink_msg_param_ext_ack_decode(last_msg, &packet2);
  8823. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8824. memset(&packet2, 0, sizeof(packet2));
  8825. mavlink_msg_param_ext_ack_send(MAVLINK_COMM_1 , packet1.param_id , packet1.param_value , packet1.param_type , packet1.param_result );
  8826. mavlink_msg_param_ext_ack_decode(last_msg, &packet2);
  8827. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8828. }
  8829. static void mavlink_test_obstacle_distance(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  8830. {
  8831. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  8832. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  8833. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_OBSTACLE_DISTANCE >= 256) {
  8834. return;
  8835. }
  8836. #endif
  8837. mavlink_message_t msg;
  8838. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  8839. uint16_t i;
  8840. mavlink_obstacle_distance_t packet_in = {
  8841. 93372036854775807ULL,{ 17651, 17652, 17653, 17654, 17655, 17656, 17657, 17658, 17659, 17660, 17661, 17662, 17663, 17664, 17665, 17666, 17667, 17668, 17669, 17670, 17671, 17672, 17673, 17674, 17675, 17676, 17677, 17678, 17679, 17680, 17681, 17682, 17683, 17684, 17685, 17686, 17687, 17688, 17689, 17690, 17691, 17692, 17693, 17694, 17695, 17696, 17697, 17698, 17699, 17700, 17701, 17702, 17703, 17704, 17705, 17706, 17707, 17708, 17709, 17710, 17711, 17712, 17713, 17714, 17715, 17716, 17717, 17718, 17719, 17720, 17721, 17722 },25139,25243,217,28,1123.0,1151.0,119
  8842. };
  8843. mavlink_obstacle_distance_t packet1, packet2;
  8844. memset(&packet1, 0, sizeof(packet1));
  8845. packet1.time_usec = packet_in.time_usec;
  8846. packet1.min_distance = packet_in.min_distance;
  8847. packet1.max_distance = packet_in.max_distance;
  8848. packet1.sensor_type = packet_in.sensor_type;
  8849. packet1.increment = packet_in.increment;
  8850. packet1.increment_f = packet_in.increment_f;
  8851. packet1.angle_offset = packet_in.angle_offset;
  8852. packet1.frame = packet_in.frame;
  8853. mav_array_memcpy(packet1.distances, packet_in.distances, sizeof(uint16_t)*72);
  8854. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  8855. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  8856. // cope with extensions
  8857. memset(MAVLINK_MSG_ID_OBSTACLE_DISTANCE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_OBSTACLE_DISTANCE_MIN_LEN);
  8858. }
  8859. #endif
  8860. memset(&packet2, 0, sizeof(packet2));
  8861. mavlink_msg_obstacle_distance_encode(system_id, component_id, &msg, &packet1);
  8862. mavlink_msg_obstacle_distance_decode(&msg, &packet2);
  8863. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8864. memset(&packet2, 0, sizeof(packet2));
  8865. mavlink_msg_obstacle_distance_pack(system_id, component_id, &msg , packet1.time_usec , packet1.sensor_type , packet1.distances , packet1.increment , packet1.min_distance , packet1.max_distance , packet1.increment_f , packet1.angle_offset , packet1.frame );
  8866. mavlink_msg_obstacle_distance_decode(&msg, &packet2);
  8867. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8868. memset(&packet2, 0, sizeof(packet2));
  8869. mavlink_msg_obstacle_distance_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.sensor_type , packet1.distances , packet1.increment , packet1.min_distance , packet1.max_distance , packet1.increment_f , packet1.angle_offset , packet1.frame );
  8870. mavlink_msg_obstacle_distance_decode(&msg, &packet2);
  8871. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8872. memset(&packet2, 0, sizeof(packet2));
  8873. mavlink_msg_to_send_buffer(buffer, &msg);
  8874. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  8875. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  8876. }
  8877. mavlink_msg_obstacle_distance_decode(last_msg, &packet2);
  8878. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8879. memset(&packet2, 0, sizeof(packet2));
  8880. mavlink_msg_obstacle_distance_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.sensor_type , packet1.distances , packet1.increment , packet1.min_distance , packet1.max_distance , packet1.increment_f , packet1.angle_offset , packet1.frame );
  8881. mavlink_msg_obstacle_distance_decode(last_msg, &packet2);
  8882. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8883. }
  8884. static void mavlink_test_odometry(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  8885. {
  8886. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  8887. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  8888. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ODOMETRY >= 256) {
  8889. return;
  8890. }
  8891. #endif
  8892. mavlink_message_t msg;
  8893. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  8894. uint16_t i;
  8895. mavlink_odometry_t packet_in = {
  8896. 93372036854775807ULL,73.0,101.0,129.0,{ 157.0, 158.0, 159.0, 160.0 },269.0,297.0,325.0,353.0,381.0,409.0,{ 437.0, 438.0, 439.0, 440.0, 441.0, 442.0, 443.0, 444.0, 445.0, 446.0, 447.0, 448.0, 449.0, 450.0, 451.0, 452.0, 453.0, 454.0, 455.0, 456.0, 457.0 },{ 1025.0, 1026.0, 1027.0, 1028.0, 1029.0, 1030.0, 1031.0, 1032.0, 1033.0, 1034.0, 1035.0, 1036.0, 1037.0, 1038.0, 1039.0, 1040.0, 1041.0, 1042.0, 1043.0, 1044.0, 1045.0 },177,244,55,122
  8897. };
  8898. mavlink_odometry_t packet1, packet2;
  8899. memset(&packet1, 0, sizeof(packet1));
  8900. packet1.time_usec = packet_in.time_usec;
  8901. packet1.x = packet_in.x;
  8902. packet1.y = packet_in.y;
  8903. packet1.z = packet_in.z;
  8904. packet1.vx = packet_in.vx;
  8905. packet1.vy = packet_in.vy;
  8906. packet1.vz = packet_in.vz;
  8907. packet1.rollspeed = packet_in.rollspeed;
  8908. packet1.pitchspeed = packet_in.pitchspeed;
  8909. packet1.yawspeed = packet_in.yawspeed;
  8910. packet1.frame_id = packet_in.frame_id;
  8911. packet1.child_frame_id = packet_in.child_frame_id;
  8912. packet1.reset_counter = packet_in.reset_counter;
  8913. packet1.estimator_type = packet_in.estimator_type;
  8914. mav_array_memcpy(packet1.q, packet_in.q, sizeof(float)*4);
  8915. mav_array_memcpy(packet1.pose_covariance, packet_in.pose_covariance, sizeof(float)*21);
  8916. mav_array_memcpy(packet1.velocity_covariance, packet_in.velocity_covariance, sizeof(float)*21);
  8917. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  8918. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  8919. // cope with extensions
  8920. memset(MAVLINK_MSG_ID_ODOMETRY_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ODOMETRY_MIN_LEN);
  8921. }
  8922. #endif
  8923. memset(&packet2, 0, sizeof(packet2));
  8924. mavlink_msg_odometry_encode(system_id, component_id, &msg, &packet1);
  8925. mavlink_msg_odometry_decode(&msg, &packet2);
  8926. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8927. memset(&packet2, 0, sizeof(packet2));
  8928. mavlink_msg_odometry_pack(system_id, component_id, &msg , packet1.time_usec , packet1.frame_id , packet1.child_frame_id , packet1.x , packet1.y , packet1.z , packet1.q , packet1.vx , packet1.vy , packet1.vz , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed , packet1.pose_covariance , packet1.velocity_covariance , packet1.reset_counter , packet1.estimator_type );
  8929. mavlink_msg_odometry_decode(&msg, &packet2);
  8930. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8931. memset(&packet2, 0, sizeof(packet2));
  8932. mavlink_msg_odometry_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.frame_id , packet1.child_frame_id , packet1.x , packet1.y , packet1.z , packet1.q , packet1.vx , packet1.vy , packet1.vz , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed , packet1.pose_covariance , packet1.velocity_covariance , packet1.reset_counter , packet1.estimator_type );
  8933. mavlink_msg_odometry_decode(&msg, &packet2);
  8934. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8935. memset(&packet2, 0, sizeof(packet2));
  8936. mavlink_msg_to_send_buffer(buffer, &msg);
  8937. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  8938. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  8939. }
  8940. mavlink_msg_odometry_decode(last_msg, &packet2);
  8941. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8942. memset(&packet2, 0, sizeof(packet2));
  8943. mavlink_msg_odometry_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.frame_id , packet1.child_frame_id , packet1.x , packet1.y , packet1.z , packet1.q , packet1.vx , packet1.vy , packet1.vz , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed , packet1.pose_covariance , packet1.velocity_covariance , packet1.reset_counter , packet1.estimator_type );
  8944. mavlink_msg_odometry_decode(last_msg, &packet2);
  8945. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8946. }
  8947. static void mavlink_test_trajectory_representation_waypoints(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  8948. {
  8949. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  8950. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  8951. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS >= 256) {
  8952. return;
  8953. }
  8954. #endif
  8955. mavlink_message_t msg;
  8956. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  8957. uint16_t i;
  8958. mavlink_trajectory_representation_waypoints_t packet_in = {
  8959. 93372036854775807ULL,{ 73.0, 74.0, 75.0, 76.0, 77.0 },{ 213.0, 214.0, 215.0, 216.0, 217.0 },{ 353.0, 354.0, 355.0, 356.0, 357.0 },{ 493.0, 494.0, 495.0, 496.0, 497.0 },{ 633.0, 634.0, 635.0, 636.0, 637.0 },{ 773.0, 774.0, 775.0, 776.0, 777.0 },{ 913.0, 914.0, 915.0, 916.0, 917.0 },{ 1053.0, 1054.0, 1055.0, 1056.0, 1057.0 },{ 1193.0, 1194.0, 1195.0, 1196.0, 1197.0 },{ 1333.0, 1334.0, 1335.0, 1336.0, 1337.0 },{ 1473.0, 1474.0, 1475.0, 1476.0, 1477.0 },{ 29091, 29092, 29093, 29094, 29095 },79
  8960. };
  8961. mavlink_trajectory_representation_waypoints_t packet1, packet2;
  8962. memset(&packet1, 0, sizeof(packet1));
  8963. packet1.time_usec = packet_in.time_usec;
  8964. packet1.valid_points = packet_in.valid_points;
  8965. mav_array_memcpy(packet1.pos_x, packet_in.pos_x, sizeof(float)*5);
  8966. mav_array_memcpy(packet1.pos_y, packet_in.pos_y, sizeof(float)*5);
  8967. mav_array_memcpy(packet1.pos_z, packet_in.pos_z, sizeof(float)*5);
  8968. mav_array_memcpy(packet1.vel_x, packet_in.vel_x, sizeof(float)*5);
  8969. mav_array_memcpy(packet1.vel_y, packet_in.vel_y, sizeof(float)*5);
  8970. mav_array_memcpy(packet1.vel_z, packet_in.vel_z, sizeof(float)*5);
  8971. mav_array_memcpy(packet1.acc_x, packet_in.acc_x, sizeof(float)*5);
  8972. mav_array_memcpy(packet1.acc_y, packet_in.acc_y, sizeof(float)*5);
  8973. mav_array_memcpy(packet1.acc_z, packet_in.acc_z, sizeof(float)*5);
  8974. mav_array_memcpy(packet1.pos_yaw, packet_in.pos_yaw, sizeof(float)*5);
  8975. mav_array_memcpy(packet1.vel_yaw, packet_in.vel_yaw, sizeof(float)*5);
  8976. mav_array_memcpy(packet1.command, packet_in.command, sizeof(uint16_t)*5);
  8977. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  8978. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  8979. // cope with extensions
  8980. memset(MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_MIN_LEN);
  8981. }
  8982. #endif
  8983. memset(&packet2, 0, sizeof(packet2));
  8984. mavlink_msg_trajectory_representation_waypoints_encode(system_id, component_id, &msg, &packet1);
  8985. mavlink_msg_trajectory_representation_waypoints_decode(&msg, &packet2);
  8986. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8987. memset(&packet2, 0, sizeof(packet2));
  8988. mavlink_msg_trajectory_representation_waypoints_pack(system_id, component_id, &msg , packet1.time_usec , packet1.valid_points , packet1.pos_x , packet1.pos_y , packet1.pos_z , packet1.vel_x , packet1.vel_y , packet1.vel_z , packet1.acc_x , packet1.acc_y , packet1.acc_z , packet1.pos_yaw , packet1.vel_yaw , packet1.command );
  8989. mavlink_msg_trajectory_representation_waypoints_decode(&msg, &packet2);
  8990. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8991. memset(&packet2, 0, sizeof(packet2));
  8992. mavlink_msg_trajectory_representation_waypoints_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.valid_points , packet1.pos_x , packet1.pos_y , packet1.pos_z , packet1.vel_x , packet1.vel_y , packet1.vel_z , packet1.acc_x , packet1.acc_y , packet1.acc_z , packet1.pos_yaw , packet1.vel_yaw , packet1.command );
  8993. mavlink_msg_trajectory_representation_waypoints_decode(&msg, &packet2);
  8994. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  8995. memset(&packet2, 0, sizeof(packet2));
  8996. mavlink_msg_to_send_buffer(buffer, &msg);
  8997. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  8998. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  8999. }
  9000. mavlink_msg_trajectory_representation_waypoints_decode(last_msg, &packet2);
  9001. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9002. memset(&packet2, 0, sizeof(packet2));
  9003. mavlink_msg_trajectory_representation_waypoints_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.valid_points , packet1.pos_x , packet1.pos_y , packet1.pos_z , packet1.vel_x , packet1.vel_y , packet1.vel_z , packet1.acc_x , packet1.acc_y , packet1.acc_z , packet1.pos_yaw , packet1.vel_yaw , packet1.command );
  9004. mavlink_msg_trajectory_representation_waypoints_decode(last_msg, &packet2);
  9005. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9006. }
  9007. static void mavlink_test_trajectory_representation_bezier(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  9008. {
  9009. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  9010. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  9011. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER >= 256) {
  9012. return;
  9013. }
  9014. #endif
  9015. mavlink_message_t msg;
  9016. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  9017. uint16_t i;
  9018. mavlink_trajectory_representation_bezier_t packet_in = {
  9019. 93372036854775807ULL,{ 73.0, 74.0, 75.0, 76.0, 77.0 },{ 213.0, 214.0, 215.0, 216.0, 217.0 },{ 353.0, 354.0, 355.0, 356.0, 357.0 },{ 493.0, 494.0, 495.0, 496.0, 497.0 },{ 633.0, 634.0, 635.0, 636.0, 637.0 },73
  9020. };
  9021. mavlink_trajectory_representation_bezier_t packet1, packet2;
  9022. memset(&packet1, 0, sizeof(packet1));
  9023. packet1.time_usec = packet_in.time_usec;
  9024. packet1.valid_points = packet_in.valid_points;
  9025. mav_array_memcpy(packet1.pos_x, packet_in.pos_x, sizeof(float)*5);
  9026. mav_array_memcpy(packet1.pos_y, packet_in.pos_y, sizeof(float)*5);
  9027. mav_array_memcpy(packet1.pos_z, packet_in.pos_z, sizeof(float)*5);
  9028. mav_array_memcpy(packet1.delta, packet_in.delta, sizeof(float)*5);
  9029. mav_array_memcpy(packet1.pos_yaw, packet_in.pos_yaw, sizeof(float)*5);
  9030. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  9031. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  9032. // cope with extensions
  9033. memset(MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_MIN_LEN);
  9034. }
  9035. #endif
  9036. memset(&packet2, 0, sizeof(packet2));
  9037. mavlink_msg_trajectory_representation_bezier_encode(system_id, component_id, &msg, &packet1);
  9038. mavlink_msg_trajectory_representation_bezier_decode(&msg, &packet2);
  9039. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9040. memset(&packet2, 0, sizeof(packet2));
  9041. mavlink_msg_trajectory_representation_bezier_pack(system_id, component_id, &msg , packet1.time_usec , packet1.valid_points , packet1.pos_x , packet1.pos_y , packet1.pos_z , packet1.delta , packet1.pos_yaw );
  9042. mavlink_msg_trajectory_representation_bezier_decode(&msg, &packet2);
  9043. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9044. memset(&packet2, 0, sizeof(packet2));
  9045. mavlink_msg_trajectory_representation_bezier_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.valid_points , packet1.pos_x , packet1.pos_y , packet1.pos_z , packet1.delta , packet1.pos_yaw );
  9046. mavlink_msg_trajectory_representation_bezier_decode(&msg, &packet2);
  9047. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9048. memset(&packet2, 0, sizeof(packet2));
  9049. mavlink_msg_to_send_buffer(buffer, &msg);
  9050. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  9051. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  9052. }
  9053. mavlink_msg_trajectory_representation_bezier_decode(last_msg, &packet2);
  9054. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9055. memset(&packet2, 0, sizeof(packet2));
  9056. mavlink_msg_trajectory_representation_bezier_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.valid_points , packet1.pos_x , packet1.pos_y , packet1.pos_z , packet1.delta , packet1.pos_yaw );
  9057. mavlink_msg_trajectory_representation_bezier_decode(last_msg, &packet2);
  9058. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9059. }
  9060. static void mavlink_test_cellular_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  9061. {
  9062. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  9063. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  9064. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_CELLULAR_STATUS >= 256) {
  9065. return;
  9066. }
  9067. #endif
  9068. mavlink_message_t msg;
  9069. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  9070. uint16_t i;
  9071. mavlink_cellular_status_t packet_in = {
  9072. 963497464,17443,17547,17651,17755,41,108
  9073. };
  9074. mavlink_cellular_status_t packet1, packet2;
  9075. memset(&packet1, 0, sizeof(packet1));
  9076. packet1.cid = packet_in.cid;
  9077. packet1.status = packet_in.status;
  9078. packet1.mcc = packet_in.mcc;
  9079. packet1.mnc = packet_in.mnc;
  9080. packet1.lac = packet_in.lac;
  9081. packet1.type = packet_in.type;
  9082. packet1.quality = packet_in.quality;
  9083. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  9084. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  9085. // cope with extensions
  9086. memset(MAVLINK_MSG_ID_CELLULAR_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_CELLULAR_STATUS_MIN_LEN);
  9087. }
  9088. #endif
  9089. memset(&packet2, 0, sizeof(packet2));
  9090. mavlink_msg_cellular_status_encode(system_id, component_id, &msg, &packet1);
  9091. mavlink_msg_cellular_status_decode(&msg, &packet2);
  9092. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9093. memset(&packet2, 0, sizeof(packet2));
  9094. mavlink_msg_cellular_status_pack(system_id, component_id, &msg , packet1.status , packet1.type , packet1.quality , packet1.mcc , packet1.mnc , packet1.lac , packet1.cid );
  9095. mavlink_msg_cellular_status_decode(&msg, &packet2);
  9096. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9097. memset(&packet2, 0, sizeof(packet2));
  9098. mavlink_msg_cellular_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.status , packet1.type , packet1.quality , packet1.mcc , packet1.mnc , packet1.lac , packet1.cid );
  9099. mavlink_msg_cellular_status_decode(&msg, &packet2);
  9100. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9101. memset(&packet2, 0, sizeof(packet2));
  9102. mavlink_msg_to_send_buffer(buffer, &msg);
  9103. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  9104. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  9105. }
  9106. mavlink_msg_cellular_status_decode(last_msg, &packet2);
  9107. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9108. memset(&packet2, 0, sizeof(packet2));
  9109. mavlink_msg_cellular_status_send(MAVLINK_COMM_1 , packet1.status , packet1.type , packet1.quality , packet1.mcc , packet1.mnc , packet1.lac , packet1.cid );
  9110. mavlink_msg_cellular_status_decode(last_msg, &packet2);
  9111. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9112. }
  9113. static void mavlink_test_isbd_link_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  9114. {
  9115. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  9116. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  9117. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ISBD_LINK_STATUS >= 256) {
  9118. return;
  9119. }
  9120. #endif
  9121. mavlink_message_t msg;
  9122. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  9123. uint16_t i;
  9124. mavlink_isbd_link_status_t packet_in = {
  9125. 93372036854775807ULL,93372036854776311ULL,18067,18171,65,132,199,10
  9126. };
  9127. mavlink_isbd_link_status_t packet1, packet2;
  9128. memset(&packet1, 0, sizeof(packet1));
  9129. packet1.timestamp = packet_in.timestamp;
  9130. packet1.last_heartbeat = packet_in.last_heartbeat;
  9131. packet1.failed_sessions = packet_in.failed_sessions;
  9132. packet1.successful_sessions = packet_in.successful_sessions;
  9133. packet1.signal_quality = packet_in.signal_quality;
  9134. packet1.ring_pending = packet_in.ring_pending;
  9135. packet1.tx_session_pending = packet_in.tx_session_pending;
  9136. packet1.rx_session_pending = packet_in.rx_session_pending;
  9137. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  9138. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  9139. // cope with extensions
  9140. memset(MAVLINK_MSG_ID_ISBD_LINK_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ISBD_LINK_STATUS_MIN_LEN);
  9141. }
  9142. #endif
  9143. memset(&packet2, 0, sizeof(packet2));
  9144. mavlink_msg_isbd_link_status_encode(system_id, component_id, &msg, &packet1);
  9145. mavlink_msg_isbd_link_status_decode(&msg, &packet2);
  9146. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9147. memset(&packet2, 0, sizeof(packet2));
  9148. mavlink_msg_isbd_link_status_pack(system_id, component_id, &msg , packet1.timestamp , packet1.last_heartbeat , packet1.failed_sessions , packet1.successful_sessions , packet1.signal_quality , packet1.ring_pending , packet1.tx_session_pending , packet1.rx_session_pending );
  9149. mavlink_msg_isbd_link_status_decode(&msg, &packet2);
  9150. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9151. memset(&packet2, 0, sizeof(packet2));
  9152. mavlink_msg_isbd_link_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.timestamp , packet1.last_heartbeat , packet1.failed_sessions , packet1.successful_sessions , packet1.signal_quality , packet1.ring_pending , packet1.tx_session_pending , packet1.rx_session_pending );
  9153. mavlink_msg_isbd_link_status_decode(&msg, &packet2);
  9154. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9155. memset(&packet2, 0, sizeof(packet2));
  9156. mavlink_msg_to_send_buffer(buffer, &msg);
  9157. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  9158. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  9159. }
  9160. mavlink_msg_isbd_link_status_decode(last_msg, &packet2);
  9161. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9162. memset(&packet2, 0, sizeof(packet2));
  9163. mavlink_msg_isbd_link_status_send(MAVLINK_COMM_1 , packet1.timestamp , packet1.last_heartbeat , packet1.failed_sessions , packet1.successful_sessions , packet1.signal_quality , packet1.ring_pending , packet1.tx_session_pending , packet1.rx_session_pending );
  9164. mavlink_msg_isbd_link_status_decode(last_msg, &packet2);
  9165. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9166. }
  9167. static void mavlink_test_utm_global_position(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  9168. {
  9169. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  9170. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  9171. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_UTM_GLOBAL_POSITION >= 256) {
  9172. return;
  9173. }
  9174. #endif
  9175. mavlink_message_t msg;
  9176. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  9177. uint16_t i;
  9178. mavlink_utm_global_position_t packet_in = {
  9179. 93372036854775807ULL,963497880,963498088,963498296,963498504,963498712,963498920,963499128,19107,19211,19315,19419,19523,19627,19731,{ 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44 },209,20
  9180. };
  9181. mavlink_utm_global_position_t packet1, packet2;
  9182. memset(&packet1, 0, sizeof(packet1));
  9183. packet1.time = packet_in.time;
  9184. packet1.lat = packet_in.lat;
  9185. packet1.lon = packet_in.lon;
  9186. packet1.alt = packet_in.alt;
  9187. packet1.relative_alt = packet_in.relative_alt;
  9188. packet1.next_lat = packet_in.next_lat;
  9189. packet1.next_lon = packet_in.next_lon;
  9190. packet1.next_alt = packet_in.next_alt;
  9191. packet1.vx = packet_in.vx;
  9192. packet1.vy = packet_in.vy;
  9193. packet1.vz = packet_in.vz;
  9194. packet1.h_acc = packet_in.h_acc;
  9195. packet1.v_acc = packet_in.v_acc;
  9196. packet1.vel_acc = packet_in.vel_acc;
  9197. packet1.update_rate = packet_in.update_rate;
  9198. packet1.flight_state = packet_in.flight_state;
  9199. packet1.flags = packet_in.flags;
  9200. mav_array_memcpy(packet1.uas_id, packet_in.uas_id, sizeof(uint8_t)*18);
  9201. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  9202. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  9203. // cope with extensions
  9204. memset(MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_MIN_LEN);
  9205. }
  9206. #endif
  9207. memset(&packet2, 0, sizeof(packet2));
  9208. mavlink_msg_utm_global_position_encode(system_id, component_id, &msg, &packet1);
  9209. mavlink_msg_utm_global_position_decode(&msg, &packet2);
  9210. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9211. memset(&packet2, 0, sizeof(packet2));
  9212. mavlink_msg_utm_global_position_pack(system_id, component_id, &msg , packet1.time , packet1.uas_id , packet1.lat , packet1.lon , packet1.alt , packet1.relative_alt , packet1.vx , packet1.vy , packet1.vz , packet1.h_acc , packet1.v_acc , packet1.vel_acc , packet1.next_lat , packet1.next_lon , packet1.next_alt , packet1.update_rate , packet1.flight_state , packet1.flags );
  9213. mavlink_msg_utm_global_position_decode(&msg, &packet2);
  9214. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9215. memset(&packet2, 0, sizeof(packet2));
  9216. mavlink_msg_utm_global_position_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time , packet1.uas_id , packet1.lat , packet1.lon , packet1.alt , packet1.relative_alt , packet1.vx , packet1.vy , packet1.vz , packet1.h_acc , packet1.v_acc , packet1.vel_acc , packet1.next_lat , packet1.next_lon , packet1.next_alt , packet1.update_rate , packet1.flight_state , packet1.flags );
  9217. mavlink_msg_utm_global_position_decode(&msg, &packet2);
  9218. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9219. memset(&packet2, 0, sizeof(packet2));
  9220. mavlink_msg_to_send_buffer(buffer, &msg);
  9221. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  9222. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  9223. }
  9224. mavlink_msg_utm_global_position_decode(last_msg, &packet2);
  9225. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9226. memset(&packet2, 0, sizeof(packet2));
  9227. mavlink_msg_utm_global_position_send(MAVLINK_COMM_1 , packet1.time , packet1.uas_id , packet1.lat , packet1.lon , packet1.alt , packet1.relative_alt , packet1.vx , packet1.vy , packet1.vz , packet1.h_acc , packet1.v_acc , packet1.vel_acc , packet1.next_lat , packet1.next_lon , packet1.next_alt , packet1.update_rate , packet1.flight_state , packet1.flags );
  9228. mavlink_msg_utm_global_position_decode(last_msg, &packet2);
  9229. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9230. }
  9231. static void mavlink_test_debug_float_array(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  9232. {
  9233. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  9234. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  9235. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY >= 256) {
  9236. return;
  9237. }
  9238. #endif
  9239. mavlink_message_t msg;
  9240. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  9241. uint16_t i;
  9242. mavlink_debug_float_array_t packet_in = {
  9243. 93372036854775807ULL,17651,"KLMNOPQRS",{ 157.0, 158.0, 159.0, 160.0, 161.0, 162.0, 163.0, 164.0, 165.0, 166.0, 167.0, 168.0, 169.0, 170.0, 171.0, 172.0, 173.0, 174.0, 175.0, 176.0, 177.0, 178.0, 179.0, 180.0, 181.0, 182.0, 183.0, 184.0, 185.0, 186.0, 187.0, 188.0, 189.0, 190.0, 191.0, 192.0, 193.0, 194.0, 195.0, 196.0, 197.0, 198.0, 199.0, 200.0, 201.0, 202.0, 203.0, 204.0, 205.0, 206.0, 207.0, 208.0, 209.0, 210.0, 211.0, 212.0, 213.0, 214.0 }
  9244. };
  9245. mavlink_debug_float_array_t packet1, packet2;
  9246. memset(&packet1, 0, sizeof(packet1));
  9247. packet1.time_usec = packet_in.time_usec;
  9248. packet1.array_id = packet_in.array_id;
  9249. mav_array_memcpy(packet1.name, packet_in.name, sizeof(char)*10);
  9250. mav_array_memcpy(packet1.data, packet_in.data, sizeof(float)*58);
  9251. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  9252. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  9253. // cope with extensions
  9254. memset(MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_MIN_LEN);
  9255. }
  9256. #endif
  9257. memset(&packet2, 0, sizeof(packet2));
  9258. mavlink_msg_debug_float_array_encode(system_id, component_id, &msg, &packet1);
  9259. mavlink_msg_debug_float_array_decode(&msg, &packet2);
  9260. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9261. memset(&packet2, 0, sizeof(packet2));
  9262. mavlink_msg_debug_float_array_pack(system_id, component_id, &msg , packet1.time_usec , packet1.name , packet1.array_id , packet1.data );
  9263. mavlink_msg_debug_float_array_decode(&msg, &packet2);
  9264. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9265. memset(&packet2, 0, sizeof(packet2));
  9266. mavlink_msg_debug_float_array_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.name , packet1.array_id , packet1.data );
  9267. mavlink_msg_debug_float_array_decode(&msg, &packet2);
  9268. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9269. memset(&packet2, 0, sizeof(packet2));
  9270. mavlink_msg_to_send_buffer(buffer, &msg);
  9271. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  9272. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  9273. }
  9274. mavlink_msg_debug_float_array_decode(last_msg, &packet2);
  9275. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9276. memset(&packet2, 0, sizeof(packet2));
  9277. mavlink_msg_debug_float_array_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.name , packet1.array_id , packet1.data );
  9278. mavlink_msg_debug_float_array_decode(last_msg, &packet2);
  9279. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9280. }
  9281. static void mavlink_test_orbit_execution_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  9282. {
  9283. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  9284. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  9285. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ORBIT_EXECUTION_STATUS >= 256) {
  9286. return;
  9287. }
  9288. #endif
  9289. mavlink_message_t msg;
  9290. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  9291. uint16_t i;
  9292. mavlink_orbit_execution_status_t packet_in = {
  9293. 93372036854775807ULL,73.0,963498088,963498296,157.0,77
  9294. };
  9295. mavlink_orbit_execution_status_t packet1, packet2;
  9296. memset(&packet1, 0, sizeof(packet1));
  9297. packet1.time_usec = packet_in.time_usec;
  9298. packet1.radius = packet_in.radius;
  9299. packet1.x = packet_in.x;
  9300. packet1.y = packet_in.y;
  9301. packet1.z = packet_in.z;
  9302. packet1.frame = packet_in.frame;
  9303. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  9304. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  9305. // cope with extensions
  9306. memset(MAVLINK_MSG_ID_ORBIT_EXECUTION_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ORBIT_EXECUTION_STATUS_MIN_LEN);
  9307. }
  9308. #endif
  9309. memset(&packet2, 0, sizeof(packet2));
  9310. mavlink_msg_orbit_execution_status_encode(system_id, component_id, &msg, &packet1);
  9311. mavlink_msg_orbit_execution_status_decode(&msg, &packet2);
  9312. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9313. memset(&packet2, 0, sizeof(packet2));
  9314. mavlink_msg_orbit_execution_status_pack(system_id, component_id, &msg , packet1.time_usec , packet1.radius , packet1.frame , packet1.x , packet1.y , packet1.z );
  9315. mavlink_msg_orbit_execution_status_decode(&msg, &packet2);
  9316. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9317. memset(&packet2, 0, sizeof(packet2));
  9318. mavlink_msg_orbit_execution_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.radius , packet1.frame , packet1.x , packet1.y , packet1.z );
  9319. mavlink_msg_orbit_execution_status_decode(&msg, &packet2);
  9320. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9321. memset(&packet2, 0, sizeof(packet2));
  9322. mavlink_msg_to_send_buffer(buffer, &msg);
  9323. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  9324. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  9325. }
  9326. mavlink_msg_orbit_execution_status_decode(last_msg, &packet2);
  9327. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9328. memset(&packet2, 0, sizeof(packet2));
  9329. mavlink_msg_orbit_execution_status_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.radius , packet1.frame , packet1.x , packet1.y , packet1.z );
  9330. mavlink_msg_orbit_execution_status_decode(last_msg, &packet2);
  9331. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9332. }
  9333. static void mavlink_test_statustext_long(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  9334. {
  9335. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  9336. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  9337. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_STATUSTEXT_LONG >= 256) {
  9338. return;
  9339. }
  9340. #endif
  9341. mavlink_message_t msg;
  9342. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  9343. uint16_t i;
  9344. mavlink_statustext_long_t packet_in = {
  9345. 5,"BCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST"
  9346. };
  9347. mavlink_statustext_long_t packet1, packet2;
  9348. memset(&packet1, 0, sizeof(packet1));
  9349. packet1.severity = packet_in.severity;
  9350. mav_array_memcpy(packet1.text, packet_in.text, sizeof(char)*254);
  9351. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  9352. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  9353. // cope with extensions
  9354. memset(MAVLINK_MSG_ID_STATUSTEXT_LONG_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_STATUSTEXT_LONG_MIN_LEN);
  9355. }
  9356. #endif
  9357. memset(&packet2, 0, sizeof(packet2));
  9358. mavlink_msg_statustext_long_encode(system_id, component_id, &msg, &packet1);
  9359. mavlink_msg_statustext_long_decode(&msg, &packet2);
  9360. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9361. memset(&packet2, 0, sizeof(packet2));
  9362. mavlink_msg_statustext_long_pack(system_id, component_id, &msg , packet1.severity , packet1.text );
  9363. mavlink_msg_statustext_long_decode(&msg, &packet2);
  9364. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9365. memset(&packet2, 0, sizeof(packet2));
  9366. mavlink_msg_statustext_long_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.severity , packet1.text );
  9367. mavlink_msg_statustext_long_decode(&msg, &packet2);
  9368. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9369. memset(&packet2, 0, sizeof(packet2));
  9370. mavlink_msg_to_send_buffer(buffer, &msg);
  9371. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  9372. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  9373. }
  9374. mavlink_msg_statustext_long_decode(last_msg, &packet2);
  9375. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9376. memset(&packet2, 0, sizeof(packet2));
  9377. mavlink_msg_statustext_long_send(MAVLINK_COMM_1 , packet1.severity , packet1.text );
  9378. mavlink_msg_statustext_long_decode(last_msg, &packet2);
  9379. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9380. }
  9381. static void mavlink_test_smart_battery_info(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  9382. {
  9383. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  9384. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  9385. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SMART_BATTERY_INFO >= 256) {
  9386. return;
  9387. }
  9388. #endif
  9389. mavlink_message_t msg;
  9390. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  9391. uint16_t i;
  9392. mavlink_smart_battery_info_t packet_in = {
  9393. 963497464,963497672,963497880,17859,17963,18067,18171,18275,199,"XYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST"
  9394. };
  9395. mavlink_smart_battery_info_t packet1, packet2;
  9396. memset(&packet1, 0, sizeof(packet1));
  9397. packet1.capacity_full_specification = packet_in.capacity_full_specification;
  9398. packet1.capacity_full = packet_in.capacity_full;
  9399. packet1.serial_number = packet_in.serial_number;
  9400. packet1.cycle_count = packet_in.cycle_count;
  9401. packet1.weight = packet_in.weight;
  9402. packet1.discharge_minimum_voltage = packet_in.discharge_minimum_voltage;
  9403. packet1.charging_minimum_voltage = packet_in.charging_minimum_voltage;
  9404. packet1.resting_minimum_voltage = packet_in.resting_minimum_voltage;
  9405. packet1.id = packet_in.id;
  9406. mav_array_memcpy(packet1.device_name, packet_in.device_name, sizeof(char)*50);
  9407. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  9408. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  9409. // cope with extensions
  9410. memset(MAVLINK_MSG_ID_SMART_BATTERY_INFO_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SMART_BATTERY_INFO_MIN_LEN);
  9411. }
  9412. #endif
  9413. memset(&packet2, 0, sizeof(packet2));
  9414. mavlink_msg_smart_battery_info_encode(system_id, component_id, &msg, &packet1);
  9415. mavlink_msg_smart_battery_info_decode(&msg, &packet2);
  9416. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9417. memset(&packet2, 0, sizeof(packet2));
  9418. mavlink_msg_smart_battery_info_pack(system_id, component_id, &msg , packet1.id , packet1.capacity_full_specification , packet1.capacity_full , packet1.cycle_count , packet1.serial_number , packet1.device_name , packet1.weight , packet1.discharge_minimum_voltage , packet1.charging_minimum_voltage , packet1.resting_minimum_voltage );
  9419. mavlink_msg_smart_battery_info_decode(&msg, &packet2);
  9420. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9421. memset(&packet2, 0, sizeof(packet2));
  9422. mavlink_msg_smart_battery_info_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.id , packet1.capacity_full_specification , packet1.capacity_full , packet1.cycle_count , packet1.serial_number , packet1.device_name , packet1.weight , packet1.discharge_minimum_voltage , packet1.charging_minimum_voltage , packet1.resting_minimum_voltage );
  9423. mavlink_msg_smart_battery_info_decode(&msg, &packet2);
  9424. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9425. memset(&packet2, 0, sizeof(packet2));
  9426. mavlink_msg_to_send_buffer(buffer, &msg);
  9427. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  9428. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  9429. }
  9430. mavlink_msg_smart_battery_info_decode(last_msg, &packet2);
  9431. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9432. memset(&packet2, 0, sizeof(packet2));
  9433. mavlink_msg_smart_battery_info_send(MAVLINK_COMM_1 , packet1.id , packet1.capacity_full_specification , packet1.capacity_full , packet1.cycle_count , packet1.serial_number , packet1.device_name , packet1.weight , packet1.discharge_minimum_voltage , packet1.charging_minimum_voltage , packet1.resting_minimum_voltage );
  9434. mavlink_msg_smart_battery_info_decode(last_msg, &packet2);
  9435. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9436. }
  9437. static void mavlink_test_smart_battery_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  9438. {
  9439. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  9440. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  9441. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SMART_BATTERY_STATUS >= 256) {
  9442. return;
  9443. }
  9444. #endif
  9445. mavlink_message_t msg;
  9446. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  9447. uint16_t i;
  9448. mavlink_smart_battery_status_t packet_in = {
  9449. 963497464,963497672,17651,17755,17859,17963,18067,{ 18171, 18172, 18173, 18174, 18175, 18176, 18177, 18178, 18179, 18180, 18181, 18182, 18183, 18184, 18185, 18186 }
  9450. };
  9451. mavlink_smart_battery_status_t packet1, packet2;
  9452. memset(&packet1, 0, sizeof(packet1));
  9453. packet1.fault_bitmask = packet_in.fault_bitmask;
  9454. packet1.time_remaining = packet_in.time_remaining;
  9455. packet1.id = packet_in.id;
  9456. packet1.capacity_remaining = packet_in.capacity_remaining;
  9457. packet1.current = packet_in.current;
  9458. packet1.temperature = packet_in.temperature;
  9459. packet1.cell_offset = packet_in.cell_offset;
  9460. mav_array_memcpy(packet1.voltages, packet_in.voltages, sizeof(uint16_t)*16);
  9461. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  9462. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  9463. // cope with extensions
  9464. memset(MAVLINK_MSG_ID_SMART_BATTERY_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SMART_BATTERY_STATUS_MIN_LEN);
  9465. }
  9466. #endif
  9467. memset(&packet2, 0, sizeof(packet2));
  9468. mavlink_msg_smart_battery_status_encode(system_id, component_id, &msg, &packet1);
  9469. mavlink_msg_smart_battery_status_decode(&msg, &packet2);
  9470. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9471. memset(&packet2, 0, sizeof(packet2));
  9472. mavlink_msg_smart_battery_status_pack(system_id, component_id, &msg , packet1.id , packet1.capacity_remaining , packet1.current , packet1.temperature , packet1.fault_bitmask , packet1.time_remaining , packet1.cell_offset , packet1.voltages );
  9473. mavlink_msg_smart_battery_status_decode(&msg, &packet2);
  9474. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9475. memset(&packet2, 0, sizeof(packet2));
  9476. mavlink_msg_smart_battery_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.id , packet1.capacity_remaining , packet1.current , packet1.temperature , packet1.fault_bitmask , packet1.time_remaining , packet1.cell_offset , packet1.voltages );
  9477. mavlink_msg_smart_battery_status_decode(&msg, &packet2);
  9478. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9479. memset(&packet2, 0, sizeof(packet2));
  9480. mavlink_msg_to_send_buffer(buffer, &msg);
  9481. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  9482. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  9483. }
  9484. mavlink_msg_smart_battery_status_decode(last_msg, &packet2);
  9485. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9486. memset(&packet2, 0, sizeof(packet2));
  9487. mavlink_msg_smart_battery_status_send(MAVLINK_COMM_1 , packet1.id , packet1.capacity_remaining , packet1.current , packet1.temperature , packet1.fault_bitmask , packet1.time_remaining , packet1.cell_offset , packet1.voltages );
  9488. mavlink_msg_smart_battery_status_decode(last_msg, &packet2);
  9489. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9490. }
  9491. static void mavlink_test_actuator_output_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  9492. {
  9493. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  9494. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  9495. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ACTUATOR_OUTPUT_STATUS >= 256) {
  9496. return;
  9497. }
  9498. #endif
  9499. mavlink_message_t msg;
  9500. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  9501. uint16_t i;
  9502. mavlink_actuator_output_status_t packet_in = {
  9503. 93372036854775807ULL,963497880,{ 101.0, 102.0, 103.0, 104.0, 105.0, 106.0, 107.0, 108.0, 109.0, 110.0, 111.0, 112.0, 113.0, 114.0, 115.0, 116.0, 117.0, 118.0, 119.0, 120.0, 121.0, 122.0, 123.0, 124.0, 125.0, 126.0, 127.0, 128.0, 129.0, 130.0, 131.0, 132.0 }
  9504. };
  9505. mavlink_actuator_output_status_t packet1, packet2;
  9506. memset(&packet1, 0, sizeof(packet1));
  9507. packet1.time_usec = packet_in.time_usec;
  9508. packet1.active = packet_in.active;
  9509. mav_array_memcpy(packet1.actuator, packet_in.actuator, sizeof(float)*32);
  9510. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  9511. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  9512. // cope with extensions
  9513. memset(MAVLINK_MSG_ID_ACTUATOR_OUTPUT_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ACTUATOR_OUTPUT_STATUS_MIN_LEN);
  9514. }
  9515. #endif
  9516. memset(&packet2, 0, sizeof(packet2));
  9517. mavlink_msg_actuator_output_status_encode(system_id, component_id, &msg, &packet1);
  9518. mavlink_msg_actuator_output_status_decode(&msg, &packet2);
  9519. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9520. memset(&packet2, 0, sizeof(packet2));
  9521. mavlink_msg_actuator_output_status_pack(system_id, component_id, &msg , packet1.time_usec , packet1.active , packet1.actuator );
  9522. mavlink_msg_actuator_output_status_decode(&msg, &packet2);
  9523. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9524. memset(&packet2, 0, sizeof(packet2));
  9525. mavlink_msg_actuator_output_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.active , packet1.actuator );
  9526. mavlink_msg_actuator_output_status_decode(&msg, &packet2);
  9527. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9528. memset(&packet2, 0, sizeof(packet2));
  9529. mavlink_msg_to_send_buffer(buffer, &msg);
  9530. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  9531. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  9532. }
  9533. mavlink_msg_actuator_output_status_decode(last_msg, &packet2);
  9534. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9535. memset(&packet2, 0, sizeof(packet2));
  9536. mavlink_msg_actuator_output_status_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.active , packet1.actuator );
  9537. mavlink_msg_actuator_output_status_decode(last_msg, &packet2);
  9538. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9539. }
  9540. static void mavlink_test_time_estimate_to_target(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  9541. {
  9542. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  9543. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  9544. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET >= 256) {
  9545. return;
  9546. }
  9547. #endif
  9548. mavlink_message_t msg;
  9549. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  9550. uint16_t i;
  9551. mavlink_time_estimate_to_target_t packet_in = {
  9552. 963497464,963497672,963497880,963498088,963498296
  9553. };
  9554. mavlink_time_estimate_to_target_t packet1, packet2;
  9555. memset(&packet1, 0, sizeof(packet1));
  9556. packet1.safe_return = packet_in.safe_return;
  9557. packet1.land = packet_in.land;
  9558. packet1.mission_next_item = packet_in.mission_next_item;
  9559. packet1.mission_end = packet_in.mission_end;
  9560. packet1.commanded_action = packet_in.commanded_action;
  9561. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  9562. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  9563. // cope with extensions
  9564. memset(MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_MIN_LEN);
  9565. }
  9566. #endif
  9567. memset(&packet2, 0, sizeof(packet2));
  9568. mavlink_msg_time_estimate_to_target_encode(system_id, component_id, &msg, &packet1);
  9569. mavlink_msg_time_estimate_to_target_decode(&msg, &packet2);
  9570. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9571. memset(&packet2, 0, sizeof(packet2));
  9572. mavlink_msg_time_estimate_to_target_pack(system_id, component_id, &msg , packet1.safe_return , packet1.land , packet1.mission_next_item , packet1.mission_end , packet1.commanded_action );
  9573. mavlink_msg_time_estimate_to_target_decode(&msg, &packet2);
  9574. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9575. memset(&packet2, 0, sizeof(packet2));
  9576. mavlink_msg_time_estimate_to_target_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.safe_return , packet1.land , packet1.mission_next_item , packet1.mission_end , packet1.commanded_action );
  9577. mavlink_msg_time_estimate_to_target_decode(&msg, &packet2);
  9578. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9579. memset(&packet2, 0, sizeof(packet2));
  9580. mavlink_msg_to_send_buffer(buffer, &msg);
  9581. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  9582. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  9583. }
  9584. mavlink_msg_time_estimate_to_target_decode(last_msg, &packet2);
  9585. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9586. memset(&packet2, 0, sizeof(packet2));
  9587. mavlink_msg_time_estimate_to_target_send(MAVLINK_COMM_1 , packet1.safe_return , packet1.land , packet1.mission_next_item , packet1.mission_end , packet1.commanded_action );
  9588. mavlink_msg_time_estimate_to_target_decode(last_msg, &packet2);
  9589. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9590. }
  9591. static void mavlink_test_tunnel(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  9592. {
  9593. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  9594. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  9595. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_TUNNEL >= 256) {
  9596. return;
  9597. }
  9598. #endif
  9599. mavlink_message_t msg;
  9600. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  9601. uint16_t i;
  9602. mavlink_tunnel_t packet_in = {
  9603. 17235,139,206,17,{ 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211 }
  9604. };
  9605. mavlink_tunnel_t packet1, packet2;
  9606. memset(&packet1, 0, sizeof(packet1));
  9607. packet1.payload_type = packet_in.payload_type;
  9608. packet1.target_system = packet_in.target_system;
  9609. packet1.target_component = packet_in.target_component;
  9610. packet1.payload_length = packet_in.payload_length;
  9611. mav_array_memcpy(packet1.payload, packet_in.payload, sizeof(uint8_t)*128);
  9612. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  9613. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  9614. // cope with extensions
  9615. memset(MAVLINK_MSG_ID_TUNNEL_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_TUNNEL_MIN_LEN);
  9616. }
  9617. #endif
  9618. memset(&packet2, 0, sizeof(packet2));
  9619. mavlink_msg_tunnel_encode(system_id, component_id, &msg, &packet1);
  9620. mavlink_msg_tunnel_decode(&msg, &packet2);
  9621. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9622. memset(&packet2, 0, sizeof(packet2));
  9623. mavlink_msg_tunnel_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.payload_type , packet1.payload_length , packet1.payload );
  9624. mavlink_msg_tunnel_decode(&msg, &packet2);
  9625. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9626. memset(&packet2, 0, sizeof(packet2));
  9627. mavlink_msg_tunnel_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.payload_type , packet1.payload_length , packet1.payload );
  9628. mavlink_msg_tunnel_decode(&msg, &packet2);
  9629. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9630. memset(&packet2, 0, sizeof(packet2));
  9631. mavlink_msg_to_send_buffer(buffer, &msg);
  9632. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  9633. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  9634. }
  9635. mavlink_msg_tunnel_decode(last_msg, &packet2);
  9636. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9637. memset(&packet2, 0, sizeof(packet2));
  9638. mavlink_msg_tunnel_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.payload_type , packet1.payload_length , packet1.payload );
  9639. mavlink_msg_tunnel_decode(last_msg, &packet2);
  9640. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9641. }
  9642. static void mavlink_test_onboard_computer_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  9643. {
  9644. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  9645. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  9646. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS >= 256) {
  9647. return;
  9648. }
  9649. #endif
  9650. mavlink_message_t msg;
  9651. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  9652. uint16_t i;
  9653. mavlink_onboard_computer_status_t packet_in = {
  9654. 93372036854775807ULL,963497880,963498088,963498296,{ 963498504, 963498505, 963498506, 963498507 },{ 963499336, 963499337, 963499338, 963499339 },{ 963500168, 963500169, 963500170, 963500171 },{ 963501000, 963501001, 963501002, 963501003, 963501004, 963501005 },{ 963502248, 963502249, 963502250, 963502251, 963502252, 963502253 },{ 963503496, 963503497, 963503498, 963503499, 963503500, 963503501 },{ 963504744, 963504745, 963504746, 963504747, 963504748, 963504749 },{ 963505992, 963505993, 963505994, 963505995, 963505996, 963505997 },{ 27011, 27012, 27013, 27014 },81,{ 148, 149, 150, 151, 152, 153, 154, 155 },{ 172, 173, 174, 175, 176, 177, 178, 179, 180, 181 },{ 74, 75, 76, 77 },{ 86, 87, 88, 89, 90, 91, 92, 93, 94, 95 },244,{ 55, 56, 57, 58, 59, 60, 61, 62 }
  9655. };
  9656. mavlink_onboard_computer_status_t packet1, packet2;
  9657. memset(&packet1, 0, sizeof(packet1));
  9658. packet1.time_usec = packet_in.time_usec;
  9659. packet1.uptime = packet_in.uptime;
  9660. packet1.ram_usage = packet_in.ram_usage;
  9661. packet1.ram_total = packet_in.ram_total;
  9662. packet1.type = packet_in.type;
  9663. packet1.temperature_board = packet_in.temperature_board;
  9664. mav_array_memcpy(packet1.storage_type, packet_in.storage_type, sizeof(uint32_t)*4);
  9665. mav_array_memcpy(packet1.storage_usage, packet_in.storage_usage, sizeof(uint32_t)*4);
  9666. mav_array_memcpy(packet1.storage_total, packet_in.storage_total, sizeof(uint32_t)*4);
  9667. mav_array_memcpy(packet1.link_type, packet_in.link_type, sizeof(uint32_t)*6);
  9668. mav_array_memcpy(packet1.link_tx_rate, packet_in.link_tx_rate, sizeof(uint32_t)*6);
  9669. mav_array_memcpy(packet1.link_rx_rate, packet_in.link_rx_rate, sizeof(uint32_t)*6);
  9670. mav_array_memcpy(packet1.link_tx_max, packet_in.link_tx_max, sizeof(uint32_t)*6);
  9671. mav_array_memcpy(packet1.link_rx_max, packet_in.link_rx_max, sizeof(uint32_t)*6);
  9672. mav_array_memcpy(packet1.fan_speed, packet_in.fan_speed, sizeof(int16_t)*4);
  9673. mav_array_memcpy(packet1.cpu_cores, packet_in.cpu_cores, sizeof(uint8_t)*8);
  9674. mav_array_memcpy(packet1.cpu_combined, packet_in.cpu_combined, sizeof(uint8_t)*10);
  9675. mav_array_memcpy(packet1.gpu_cores, packet_in.gpu_cores, sizeof(uint8_t)*4);
  9676. mav_array_memcpy(packet1.gpu_combined, packet_in.gpu_combined, sizeof(uint8_t)*10);
  9677. mav_array_memcpy(packet1.temperature_core, packet_in.temperature_core, sizeof(int8_t)*8);
  9678. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  9679. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  9680. // cope with extensions
  9681. memset(MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_MIN_LEN);
  9682. }
  9683. #endif
  9684. memset(&packet2, 0, sizeof(packet2));
  9685. mavlink_msg_onboard_computer_status_encode(system_id, component_id, &msg, &packet1);
  9686. mavlink_msg_onboard_computer_status_decode(&msg, &packet2);
  9687. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9688. memset(&packet2, 0, sizeof(packet2));
  9689. mavlink_msg_onboard_computer_status_pack(system_id, component_id, &msg , packet1.time_usec , packet1.uptime , packet1.type , packet1.cpu_cores , packet1.cpu_combined , packet1.gpu_cores , packet1.gpu_combined , packet1.temperature_board , packet1.temperature_core , packet1.fan_speed , packet1.ram_usage , packet1.ram_total , packet1.storage_type , packet1.storage_usage , packet1.storage_total , packet1.link_type , packet1.link_tx_rate , packet1.link_rx_rate , packet1.link_tx_max , packet1.link_rx_max );
  9690. mavlink_msg_onboard_computer_status_decode(&msg, &packet2);
  9691. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9692. memset(&packet2, 0, sizeof(packet2));
  9693. mavlink_msg_onboard_computer_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.uptime , packet1.type , packet1.cpu_cores , packet1.cpu_combined , packet1.gpu_cores , packet1.gpu_combined , packet1.temperature_board , packet1.temperature_core , packet1.fan_speed , packet1.ram_usage , packet1.ram_total , packet1.storage_type , packet1.storage_usage , packet1.storage_total , packet1.link_type , packet1.link_tx_rate , packet1.link_rx_rate , packet1.link_tx_max , packet1.link_rx_max );
  9694. mavlink_msg_onboard_computer_status_decode(&msg, &packet2);
  9695. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9696. memset(&packet2, 0, sizeof(packet2));
  9697. mavlink_msg_to_send_buffer(buffer, &msg);
  9698. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  9699. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  9700. }
  9701. mavlink_msg_onboard_computer_status_decode(last_msg, &packet2);
  9702. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9703. memset(&packet2, 0, sizeof(packet2));
  9704. mavlink_msg_onboard_computer_status_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.uptime , packet1.type , packet1.cpu_cores , packet1.cpu_combined , packet1.gpu_cores , packet1.gpu_combined , packet1.temperature_board , packet1.temperature_core , packet1.fan_speed , packet1.ram_usage , packet1.ram_total , packet1.storage_type , packet1.storage_usage , packet1.storage_total , packet1.link_type , packet1.link_tx_rate , packet1.link_rx_rate , packet1.link_tx_max , packet1.link_rx_max );
  9705. mavlink_msg_onboard_computer_status_decode(last_msg, &packet2);
  9706. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9707. }
  9708. static void mavlink_test_play_tune_v2(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  9709. {
  9710. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  9711. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  9712. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_PLAY_TUNE_V2 >= 256) {
  9713. return;
  9714. }
  9715. #endif
  9716. mavlink_message_t msg;
  9717. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  9718. uint16_t i;
  9719. mavlink_play_tune_v2_t packet_in = {
  9720. 963497464,17,84,"GHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRS"
  9721. };
  9722. mavlink_play_tune_v2_t packet1, packet2;
  9723. memset(&packet1, 0, sizeof(packet1));
  9724. packet1.format = packet_in.format;
  9725. packet1.target_system = packet_in.target_system;
  9726. packet1.target_component = packet_in.target_component;
  9727. mav_array_memcpy(packet1.tune, packet_in.tune, sizeof(char)*248);
  9728. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  9729. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  9730. // cope with extensions
  9731. memset(MAVLINK_MSG_ID_PLAY_TUNE_V2_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_PLAY_TUNE_V2_MIN_LEN);
  9732. }
  9733. #endif
  9734. memset(&packet2, 0, sizeof(packet2));
  9735. mavlink_msg_play_tune_v2_encode(system_id, component_id, &msg, &packet1);
  9736. mavlink_msg_play_tune_v2_decode(&msg, &packet2);
  9737. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9738. memset(&packet2, 0, sizeof(packet2));
  9739. mavlink_msg_play_tune_v2_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.format , packet1.tune );
  9740. mavlink_msg_play_tune_v2_decode(&msg, &packet2);
  9741. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9742. memset(&packet2, 0, sizeof(packet2));
  9743. mavlink_msg_play_tune_v2_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.format , packet1.tune );
  9744. mavlink_msg_play_tune_v2_decode(&msg, &packet2);
  9745. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9746. memset(&packet2, 0, sizeof(packet2));
  9747. mavlink_msg_to_send_buffer(buffer, &msg);
  9748. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  9749. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  9750. }
  9751. mavlink_msg_play_tune_v2_decode(last_msg, &packet2);
  9752. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9753. memset(&packet2, 0, sizeof(packet2));
  9754. mavlink_msg_play_tune_v2_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.format , packet1.tune );
  9755. mavlink_msg_play_tune_v2_decode(last_msg, &packet2);
  9756. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9757. }
  9758. static void mavlink_test_supported_tunes(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  9759. {
  9760. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  9761. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  9762. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SUPPORTED_TUNES >= 256) {
  9763. return;
  9764. }
  9765. #endif
  9766. mavlink_message_t msg;
  9767. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  9768. uint16_t i;
  9769. mavlink_supported_tunes_t packet_in = {
  9770. 963497464,17,84
  9771. };
  9772. mavlink_supported_tunes_t packet1, packet2;
  9773. memset(&packet1, 0, sizeof(packet1));
  9774. packet1.format = packet_in.format;
  9775. packet1.target_system = packet_in.target_system;
  9776. packet1.target_component = packet_in.target_component;
  9777. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  9778. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  9779. // cope with extensions
  9780. memset(MAVLINK_MSG_ID_SUPPORTED_TUNES_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SUPPORTED_TUNES_MIN_LEN);
  9781. }
  9782. #endif
  9783. memset(&packet2, 0, sizeof(packet2));
  9784. mavlink_msg_supported_tunes_encode(system_id, component_id, &msg, &packet1);
  9785. mavlink_msg_supported_tunes_decode(&msg, &packet2);
  9786. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9787. memset(&packet2, 0, sizeof(packet2));
  9788. mavlink_msg_supported_tunes_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.format );
  9789. mavlink_msg_supported_tunes_decode(&msg, &packet2);
  9790. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9791. memset(&packet2, 0, sizeof(packet2));
  9792. mavlink_msg_supported_tunes_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.format );
  9793. mavlink_msg_supported_tunes_decode(&msg, &packet2);
  9794. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9795. memset(&packet2, 0, sizeof(packet2));
  9796. mavlink_msg_to_send_buffer(buffer, &msg);
  9797. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  9798. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  9799. }
  9800. mavlink_msg_supported_tunes_decode(last_msg, &packet2);
  9801. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9802. memset(&packet2, 0, sizeof(packet2));
  9803. mavlink_msg_supported_tunes_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.format );
  9804. mavlink_msg_supported_tunes_decode(last_msg, &packet2);
  9805. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9806. }
  9807. static void mavlink_test_wheel_distance(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  9808. {
  9809. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  9810. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  9811. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_WHEEL_DISTANCE >= 256) {
  9812. return;
  9813. }
  9814. #endif
  9815. mavlink_message_t msg;
  9816. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  9817. uint16_t i;
  9818. mavlink_wheel_distance_t packet_in = {
  9819. 93372036854775807ULL,{ 179.0, 180.0, 181.0, 182.0, 183.0, 184.0, 185.0, 186.0, 187.0, 188.0, 189.0, 190.0, 191.0, 192.0, 193.0, 194.0 },157
  9820. };
  9821. mavlink_wheel_distance_t packet1, packet2;
  9822. memset(&packet1, 0, sizeof(packet1));
  9823. packet1.time_usec = packet_in.time_usec;
  9824. packet1.count = packet_in.count;
  9825. mav_array_memcpy(packet1.distance, packet_in.distance, sizeof(double)*16);
  9826. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  9827. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  9828. // cope with extensions
  9829. memset(MAVLINK_MSG_ID_WHEEL_DISTANCE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_WHEEL_DISTANCE_MIN_LEN);
  9830. }
  9831. #endif
  9832. memset(&packet2, 0, sizeof(packet2));
  9833. mavlink_msg_wheel_distance_encode(system_id, component_id, &msg, &packet1);
  9834. mavlink_msg_wheel_distance_decode(&msg, &packet2);
  9835. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9836. memset(&packet2, 0, sizeof(packet2));
  9837. mavlink_msg_wheel_distance_pack(system_id, component_id, &msg , packet1.time_usec , packet1.count , packet1.distance );
  9838. mavlink_msg_wheel_distance_decode(&msg, &packet2);
  9839. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9840. memset(&packet2, 0, sizeof(packet2));
  9841. mavlink_msg_wheel_distance_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.count , packet1.distance );
  9842. mavlink_msg_wheel_distance_decode(&msg, &packet2);
  9843. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9844. memset(&packet2, 0, sizeof(packet2));
  9845. mavlink_msg_to_send_buffer(buffer, &msg);
  9846. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  9847. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  9848. }
  9849. mavlink_msg_wheel_distance_decode(last_msg, &packet2);
  9850. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9851. memset(&packet2, 0, sizeof(packet2));
  9852. mavlink_msg_wheel_distance_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.count , packet1.distance );
  9853. mavlink_msg_wheel_distance_decode(last_msg, &packet2);
  9854. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9855. }
  9856. static void mavlink_test_open_drone_id_basic_id(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  9857. {
  9858. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  9859. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  9860. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_OPEN_DRONE_ID_BASIC_ID >= 256) {
  9861. return;
  9862. }
  9863. #endif
  9864. mavlink_message_t msg;
  9865. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  9866. uint16_t i;
  9867. mavlink_open_drone_id_basic_id_t packet_in = {
  9868. 5,72,{ 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158 }
  9869. };
  9870. mavlink_open_drone_id_basic_id_t packet1, packet2;
  9871. memset(&packet1, 0, sizeof(packet1));
  9872. packet1.id_type = packet_in.id_type;
  9873. packet1.ua_type = packet_in.ua_type;
  9874. mav_array_memcpy(packet1.uas_id, packet_in.uas_id, sizeof(uint8_t)*20);
  9875. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  9876. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  9877. // cope with extensions
  9878. memset(MAVLINK_MSG_ID_OPEN_DRONE_ID_BASIC_ID_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_OPEN_DRONE_ID_BASIC_ID_MIN_LEN);
  9879. }
  9880. #endif
  9881. memset(&packet2, 0, sizeof(packet2));
  9882. mavlink_msg_open_drone_id_basic_id_encode(system_id, component_id, &msg, &packet1);
  9883. mavlink_msg_open_drone_id_basic_id_decode(&msg, &packet2);
  9884. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9885. memset(&packet2, 0, sizeof(packet2));
  9886. mavlink_msg_open_drone_id_basic_id_pack(system_id, component_id, &msg , packet1.id_type , packet1.ua_type , packet1.uas_id );
  9887. mavlink_msg_open_drone_id_basic_id_decode(&msg, &packet2);
  9888. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9889. memset(&packet2, 0, sizeof(packet2));
  9890. mavlink_msg_open_drone_id_basic_id_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.id_type , packet1.ua_type , packet1.uas_id );
  9891. mavlink_msg_open_drone_id_basic_id_decode(&msg, &packet2);
  9892. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9893. memset(&packet2, 0, sizeof(packet2));
  9894. mavlink_msg_to_send_buffer(buffer, &msg);
  9895. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  9896. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  9897. }
  9898. mavlink_msg_open_drone_id_basic_id_decode(last_msg, &packet2);
  9899. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9900. memset(&packet2, 0, sizeof(packet2));
  9901. mavlink_msg_open_drone_id_basic_id_send(MAVLINK_COMM_1 , packet1.id_type , packet1.ua_type , packet1.uas_id );
  9902. mavlink_msg_open_drone_id_basic_id_decode(last_msg, &packet2);
  9903. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9904. }
  9905. static void mavlink_test_open_drone_id_location(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  9906. {
  9907. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  9908. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  9909. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION >= 256) {
  9910. return;
  9911. }
  9912. #endif
  9913. mavlink_message_t msg;
  9914. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  9915. uint16_t i;
  9916. mavlink_open_drone_id_location_t packet_in = {
  9917. 963497464,963497672,73.0,101.0,129.0,157.0,18483,18587,18691,223,34,101,168,235,46,113
  9918. };
  9919. mavlink_open_drone_id_location_t packet1, packet2;
  9920. memset(&packet1, 0, sizeof(packet1));
  9921. packet1.latitude = packet_in.latitude;
  9922. packet1.longitude = packet_in.longitude;
  9923. packet1.altitude_barometric = packet_in.altitude_barometric;
  9924. packet1.altitude_geodetic = packet_in.altitude_geodetic;
  9925. packet1.height = packet_in.height;
  9926. packet1.timestamp = packet_in.timestamp;
  9927. packet1.direction = packet_in.direction;
  9928. packet1.speed_horizontal = packet_in.speed_horizontal;
  9929. packet1.speed_vertical = packet_in.speed_vertical;
  9930. packet1.status = packet_in.status;
  9931. packet1.height_reference = packet_in.height_reference;
  9932. packet1.horizontal_accuracy = packet_in.horizontal_accuracy;
  9933. packet1.vertical_accuracy = packet_in.vertical_accuracy;
  9934. packet1.barometer_accuracy = packet_in.barometer_accuracy;
  9935. packet1.speed_accuracy = packet_in.speed_accuracy;
  9936. packet1.timestamp_accuracy = packet_in.timestamp_accuracy;
  9937. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  9938. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  9939. // cope with extensions
  9940. memset(MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_MIN_LEN);
  9941. }
  9942. #endif
  9943. memset(&packet2, 0, sizeof(packet2));
  9944. mavlink_msg_open_drone_id_location_encode(system_id, component_id, &msg, &packet1);
  9945. mavlink_msg_open_drone_id_location_decode(&msg, &packet2);
  9946. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9947. memset(&packet2, 0, sizeof(packet2));
  9948. mavlink_msg_open_drone_id_location_pack(system_id, component_id, &msg , packet1.status , packet1.direction , packet1.speed_horizontal , packet1.speed_vertical , packet1.latitude , packet1.longitude , packet1.altitude_barometric , packet1.altitude_geodetic , packet1.height_reference , packet1.height , packet1.horizontal_accuracy , packet1.vertical_accuracy , packet1.barometer_accuracy , packet1.speed_accuracy , packet1.timestamp , packet1.timestamp_accuracy );
  9949. mavlink_msg_open_drone_id_location_decode(&msg, &packet2);
  9950. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9951. memset(&packet2, 0, sizeof(packet2));
  9952. mavlink_msg_open_drone_id_location_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.status , packet1.direction , packet1.speed_horizontal , packet1.speed_vertical , packet1.latitude , packet1.longitude , packet1.altitude_barometric , packet1.altitude_geodetic , packet1.height_reference , packet1.height , packet1.horizontal_accuracy , packet1.vertical_accuracy , packet1.barometer_accuracy , packet1.speed_accuracy , packet1.timestamp , packet1.timestamp_accuracy );
  9953. mavlink_msg_open_drone_id_location_decode(&msg, &packet2);
  9954. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9955. memset(&packet2, 0, sizeof(packet2));
  9956. mavlink_msg_to_send_buffer(buffer, &msg);
  9957. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  9958. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  9959. }
  9960. mavlink_msg_open_drone_id_location_decode(last_msg, &packet2);
  9961. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9962. memset(&packet2, 0, sizeof(packet2));
  9963. mavlink_msg_open_drone_id_location_send(MAVLINK_COMM_1 , packet1.status , packet1.direction , packet1.speed_horizontal , packet1.speed_vertical , packet1.latitude , packet1.longitude , packet1.altitude_barometric , packet1.altitude_geodetic , packet1.height_reference , packet1.height , packet1.horizontal_accuracy , packet1.vertical_accuracy , packet1.barometer_accuracy , packet1.speed_accuracy , packet1.timestamp , packet1.timestamp_accuracy );
  9964. mavlink_msg_open_drone_id_location_decode(last_msg, &packet2);
  9965. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9966. }
  9967. static void mavlink_test_open_drone_id_authentication(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  9968. {
  9969. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  9970. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  9971. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION >= 256) {
  9972. return;
  9973. }
  9974. #endif
  9975. mavlink_message_t msg;
  9976. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  9977. uint16_t i;
  9978. mavlink_open_drone_id_authentication_t packet_in = {
  9979. 963497464,17,84,151,218,{ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51 }
  9980. };
  9981. mavlink_open_drone_id_authentication_t packet1, packet2;
  9982. memset(&packet1, 0, sizeof(packet1));
  9983. packet1.timestamp = packet_in.timestamp;
  9984. packet1.authentication_type = packet_in.authentication_type;
  9985. packet1.data_page = packet_in.data_page;
  9986. packet1.page_count = packet_in.page_count;
  9987. packet1.length = packet_in.length;
  9988. mav_array_memcpy(packet1.authentication_data, packet_in.authentication_data, sizeof(uint8_t)*23);
  9989. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  9990. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  9991. // cope with extensions
  9992. memset(MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_MIN_LEN);
  9993. }
  9994. #endif
  9995. memset(&packet2, 0, sizeof(packet2));
  9996. mavlink_msg_open_drone_id_authentication_encode(system_id, component_id, &msg, &packet1);
  9997. mavlink_msg_open_drone_id_authentication_decode(&msg, &packet2);
  9998. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  9999. memset(&packet2, 0, sizeof(packet2));
  10000. mavlink_msg_open_drone_id_authentication_pack(system_id, component_id, &msg , packet1.authentication_type , packet1.data_page , packet1.page_count , packet1.length , packet1.timestamp , packet1.authentication_data );
  10001. mavlink_msg_open_drone_id_authentication_decode(&msg, &packet2);
  10002. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  10003. memset(&packet2, 0, sizeof(packet2));
  10004. mavlink_msg_open_drone_id_authentication_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.authentication_type , packet1.data_page , packet1.page_count , packet1.length , packet1.timestamp , packet1.authentication_data );
  10005. mavlink_msg_open_drone_id_authentication_decode(&msg, &packet2);
  10006. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  10007. memset(&packet2, 0, sizeof(packet2));
  10008. mavlink_msg_to_send_buffer(buffer, &msg);
  10009. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  10010. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  10011. }
  10012. mavlink_msg_open_drone_id_authentication_decode(last_msg, &packet2);
  10013. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  10014. memset(&packet2, 0, sizeof(packet2));
  10015. mavlink_msg_open_drone_id_authentication_send(MAVLINK_COMM_1 , packet1.authentication_type , packet1.data_page , packet1.page_count , packet1.length , packet1.timestamp , packet1.authentication_data );
  10016. mavlink_msg_open_drone_id_authentication_decode(last_msg, &packet2);
  10017. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  10018. }
  10019. static void mavlink_test_open_drone_id_self_id(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  10020. {
  10021. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  10022. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  10023. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_OPEN_DRONE_ID_SELF_ID >= 256) {
  10024. return;
  10025. }
  10026. #endif
  10027. mavlink_message_t msg;
  10028. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  10029. uint16_t i;
  10030. mavlink_open_drone_id_self_id_t packet_in = {
  10031. 5,"BCDEFGHIJKLMNOPQRSTUVW"
  10032. };
  10033. mavlink_open_drone_id_self_id_t packet1, packet2;
  10034. memset(&packet1, 0, sizeof(packet1));
  10035. packet1.description_type = packet_in.description_type;
  10036. mav_array_memcpy(packet1.description, packet_in.description, sizeof(char)*23);
  10037. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  10038. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  10039. // cope with extensions
  10040. memset(MAVLINK_MSG_ID_OPEN_DRONE_ID_SELF_ID_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_OPEN_DRONE_ID_SELF_ID_MIN_LEN);
  10041. }
  10042. #endif
  10043. memset(&packet2, 0, sizeof(packet2));
  10044. mavlink_msg_open_drone_id_self_id_encode(system_id, component_id, &msg, &packet1);
  10045. mavlink_msg_open_drone_id_self_id_decode(&msg, &packet2);
  10046. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  10047. memset(&packet2, 0, sizeof(packet2));
  10048. mavlink_msg_open_drone_id_self_id_pack(system_id, component_id, &msg , packet1.description_type , packet1.description );
  10049. mavlink_msg_open_drone_id_self_id_decode(&msg, &packet2);
  10050. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  10051. memset(&packet2, 0, sizeof(packet2));
  10052. mavlink_msg_open_drone_id_self_id_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.description_type , packet1.description );
  10053. mavlink_msg_open_drone_id_self_id_decode(&msg, &packet2);
  10054. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  10055. memset(&packet2, 0, sizeof(packet2));
  10056. mavlink_msg_to_send_buffer(buffer, &msg);
  10057. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  10058. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  10059. }
  10060. mavlink_msg_open_drone_id_self_id_decode(last_msg, &packet2);
  10061. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  10062. memset(&packet2, 0, sizeof(packet2));
  10063. mavlink_msg_open_drone_id_self_id_send(MAVLINK_COMM_1 , packet1.description_type , packet1.description );
  10064. mavlink_msg_open_drone_id_self_id_decode(last_msg, &packet2);
  10065. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  10066. }
  10067. static void mavlink_test_open_drone_id_system(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  10068. {
  10069. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  10070. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  10071. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM >= 256) {
  10072. return;
  10073. }
  10074. #endif
  10075. mavlink_message_t msg;
  10076. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  10077. uint16_t i;
  10078. mavlink_open_drone_id_system_t packet_in = {
  10079. 963497464,963497672,73.0,101.0,18067,18171,65
  10080. };
  10081. mavlink_open_drone_id_system_t packet1, packet2;
  10082. memset(&packet1, 0, sizeof(packet1));
  10083. packet1.operator_latitude = packet_in.operator_latitude;
  10084. packet1.operator_longitude = packet_in.operator_longitude;
  10085. packet1.area_ceiling = packet_in.area_ceiling;
  10086. packet1.area_floor = packet_in.area_floor;
  10087. packet1.area_count = packet_in.area_count;
  10088. packet1.area_radius = packet_in.area_radius;
  10089. packet1.flags = packet_in.flags;
  10090. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  10091. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  10092. // cope with extensions
  10093. memset(MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_MIN_LEN);
  10094. }
  10095. #endif
  10096. memset(&packet2, 0, sizeof(packet2));
  10097. mavlink_msg_open_drone_id_system_encode(system_id, component_id, &msg, &packet1);
  10098. mavlink_msg_open_drone_id_system_decode(&msg, &packet2);
  10099. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  10100. memset(&packet2, 0, sizeof(packet2));
  10101. mavlink_msg_open_drone_id_system_pack(system_id, component_id, &msg , packet1.flags , packet1.operator_latitude , packet1.operator_longitude , packet1.area_count , packet1.area_radius , packet1.area_ceiling , packet1.area_floor );
  10102. mavlink_msg_open_drone_id_system_decode(&msg, &packet2);
  10103. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  10104. memset(&packet2, 0, sizeof(packet2));
  10105. mavlink_msg_open_drone_id_system_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.flags , packet1.operator_latitude , packet1.operator_longitude , packet1.area_count , packet1.area_radius , packet1.area_ceiling , packet1.area_floor );
  10106. mavlink_msg_open_drone_id_system_decode(&msg, &packet2);
  10107. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  10108. memset(&packet2, 0, sizeof(packet2));
  10109. mavlink_msg_to_send_buffer(buffer, &msg);
  10110. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  10111. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  10112. }
  10113. mavlink_msg_open_drone_id_system_decode(last_msg, &packet2);
  10114. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  10115. memset(&packet2, 0, sizeof(packet2));
  10116. mavlink_msg_open_drone_id_system_send(MAVLINK_COMM_1 , packet1.flags , packet1.operator_latitude , packet1.operator_longitude , packet1.area_count , packet1.area_radius , packet1.area_ceiling , packet1.area_floor );
  10117. mavlink_msg_open_drone_id_system_decode(last_msg, &packet2);
  10118. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  10119. }
  10120. static void mavlink_test_open_drone_id_operator_id(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  10121. {
  10122. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  10123. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  10124. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_OPEN_DRONE_ID_OPERATOR_ID >= 256) {
  10125. return;
  10126. }
  10127. #endif
  10128. mavlink_message_t msg;
  10129. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  10130. uint16_t i;
  10131. mavlink_open_drone_id_operator_id_t packet_in = {
  10132. 5,"BCDEFGHIJKLMNOPQRST"
  10133. };
  10134. mavlink_open_drone_id_operator_id_t packet1, packet2;
  10135. memset(&packet1, 0, sizeof(packet1));
  10136. packet1.operator_id_type = packet_in.operator_id_type;
  10137. mav_array_memcpy(packet1.operator_id, packet_in.operator_id, sizeof(char)*20);
  10138. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  10139. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  10140. // cope with extensions
  10141. memset(MAVLINK_MSG_ID_OPEN_DRONE_ID_OPERATOR_ID_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_OPEN_DRONE_ID_OPERATOR_ID_MIN_LEN);
  10142. }
  10143. #endif
  10144. memset(&packet2, 0, sizeof(packet2));
  10145. mavlink_msg_open_drone_id_operator_id_encode(system_id, component_id, &msg, &packet1);
  10146. mavlink_msg_open_drone_id_operator_id_decode(&msg, &packet2);
  10147. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  10148. memset(&packet2, 0, sizeof(packet2));
  10149. mavlink_msg_open_drone_id_operator_id_pack(system_id, component_id, &msg , packet1.operator_id_type , packet1.operator_id );
  10150. mavlink_msg_open_drone_id_operator_id_decode(&msg, &packet2);
  10151. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  10152. memset(&packet2, 0, sizeof(packet2));
  10153. mavlink_msg_open_drone_id_operator_id_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.operator_id_type , packet1.operator_id );
  10154. mavlink_msg_open_drone_id_operator_id_decode(&msg, &packet2);
  10155. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  10156. memset(&packet2, 0, sizeof(packet2));
  10157. mavlink_msg_to_send_buffer(buffer, &msg);
  10158. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  10159. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  10160. }
  10161. mavlink_msg_open_drone_id_operator_id_decode(last_msg, &packet2);
  10162. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  10163. memset(&packet2, 0, sizeof(packet2));
  10164. mavlink_msg_open_drone_id_operator_id_send(MAVLINK_COMM_1 , packet1.operator_id_type , packet1.operator_id );
  10165. mavlink_msg_open_drone_id_operator_id_decode(last_msg, &packet2);
  10166. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  10167. }
  10168. static void mavlink_test_open_drone_id_message_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  10169. {
  10170. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  10171. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  10172. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK >= 256) {
  10173. return;
  10174. }
  10175. #endif
  10176. mavlink_message_t msg;
  10177. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  10178. uint16_t i;
  10179. mavlink_open_drone_id_message_pack_t packet_in = {
  10180. 5,72,{ 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132 }
  10181. };
  10182. mavlink_open_drone_id_message_pack_t packet1, packet2;
  10183. memset(&packet1, 0, sizeof(packet1));
  10184. packet1.single_message_size = packet_in.single_message_size;
  10185. packet1.msg_pack_size = packet_in.msg_pack_size;
  10186. mav_array_memcpy(packet1.messages, packet_in.messages, sizeof(uint8_t)*250);
  10187. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  10188. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  10189. // cope with extensions
  10190. memset(MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_OPEN_DRONE_ID_MESSAGE_PACK_MIN_LEN);
  10191. }
  10192. #endif
  10193. memset(&packet2, 0, sizeof(packet2));
  10194. mavlink_msg_open_drone_id_message_pack_encode(system_id, component_id, &msg, &packet1);
  10195. mavlink_msg_open_drone_id_message_pack_decode(&msg, &packet2);
  10196. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  10197. memset(&packet2, 0, sizeof(packet2));
  10198. mavlink_msg_open_drone_id_message_pack_pack(system_id, component_id, &msg , packet1.single_message_size , packet1.msg_pack_size , packet1.messages );
  10199. mavlink_msg_open_drone_id_message_pack_decode(&msg, &packet2);
  10200. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  10201. memset(&packet2, 0, sizeof(packet2));
  10202. mavlink_msg_open_drone_id_message_pack_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.single_message_size , packet1.msg_pack_size , packet1.messages );
  10203. mavlink_msg_open_drone_id_message_pack_decode(&msg, &packet2);
  10204. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  10205. memset(&packet2, 0, sizeof(packet2));
  10206. mavlink_msg_to_send_buffer(buffer, &msg);
  10207. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  10208. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  10209. }
  10210. mavlink_msg_open_drone_id_message_pack_decode(last_msg, &packet2);
  10211. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  10212. memset(&packet2, 0, sizeof(packet2));
  10213. mavlink_msg_open_drone_id_message_pack_send(MAVLINK_COMM_1 , packet1.single_message_size , packet1.msg_pack_size , packet1.messages );
  10214. mavlink_msg_open_drone_id_message_pack_decode(last_msg, &packet2);
  10215. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  10216. }
  10217. static void mavlink_test_common(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  10218. {
  10219. mavlink_test_heartbeat(system_id, component_id, last_msg);
  10220. mavlink_test_sys_status(system_id, component_id, last_msg);
  10221. mavlink_test_system_time(system_id, component_id, last_msg);
  10222. mavlink_test_ping(system_id, component_id, last_msg);
  10223. mavlink_test_change_operator_control(system_id, component_id, last_msg);
  10224. mavlink_test_change_operator_control_ack(system_id, component_id, last_msg);
  10225. mavlink_test_auth_key(system_id, component_id, last_msg);
  10226. mavlink_test_link_node_status(system_id, component_id, last_msg);
  10227. mavlink_test_set_mode(system_id, component_id, last_msg);
  10228. mavlink_test_param_request_read(system_id, component_id, last_msg);
  10229. mavlink_test_param_request_list(system_id, component_id, last_msg);
  10230. mavlink_test_param_value(system_id, component_id, last_msg);
  10231. mavlink_test_param_set(system_id, component_id, last_msg);
  10232. mavlink_test_gps_raw_int(system_id, component_id, last_msg);
  10233. mavlink_test_gps_status(system_id, component_id, last_msg);
  10234. mavlink_test_scaled_imu(system_id, component_id, last_msg);
  10235. mavlink_test_raw_imu(system_id, component_id, last_msg);
  10236. mavlink_test_raw_pressure(system_id, component_id, last_msg);
  10237. mavlink_test_scaled_pressure(system_id, component_id, last_msg);
  10238. mavlink_test_attitude(system_id, component_id, last_msg);
  10239. mavlink_test_attitude_quaternion(system_id, component_id, last_msg);
  10240. mavlink_test_local_position_ned(system_id, component_id, last_msg);
  10241. mavlink_test_global_position_int(system_id, component_id, last_msg);
  10242. mavlink_test_rc_channels_scaled(system_id, component_id, last_msg);
  10243. mavlink_test_rc_channels_raw(system_id, component_id, last_msg);
  10244. mavlink_test_servo_output_raw(system_id, component_id, last_msg);
  10245. mavlink_test_mission_request_partial_list(system_id, component_id, last_msg);
  10246. mavlink_test_mission_write_partial_list(system_id, component_id, last_msg);
  10247. mavlink_test_mission_item(system_id, component_id, last_msg);
  10248. mavlink_test_mission_request(system_id, component_id, last_msg);
  10249. mavlink_test_mission_set_current(system_id, component_id, last_msg);
  10250. mavlink_test_mission_current(system_id, component_id, last_msg);
  10251. mavlink_test_mission_request_list(system_id, component_id, last_msg);
  10252. mavlink_test_mission_count(system_id, component_id, last_msg);
  10253. mavlink_test_mission_clear_all(system_id, component_id, last_msg);
  10254. mavlink_test_mission_item_reached(system_id, component_id, last_msg);
  10255. mavlink_test_mission_ack(system_id, component_id, last_msg);
  10256. mavlink_test_set_gps_global_origin(system_id, component_id, last_msg);
  10257. mavlink_test_gps_global_origin(system_id, component_id, last_msg);
  10258. mavlink_test_param_map_rc(system_id, component_id, last_msg);
  10259. mavlink_test_mission_request_int(system_id, component_id, last_msg);
  10260. mavlink_test_mission_changed(system_id, component_id, last_msg);
  10261. mavlink_test_safety_set_allowed_area(system_id, component_id, last_msg);
  10262. mavlink_test_safety_allowed_area(system_id, component_id, last_msg);
  10263. mavlink_test_attitude_quaternion_cov(system_id, component_id, last_msg);
  10264. mavlink_test_nav_controller_output(system_id, component_id, last_msg);
  10265. mavlink_test_global_position_int_cov(system_id, component_id, last_msg);
  10266. mavlink_test_local_position_ned_cov(system_id, component_id, last_msg);
  10267. mavlink_test_rc_channels(system_id, component_id, last_msg);
  10268. mavlink_test_request_data_stream(system_id, component_id, last_msg);
  10269. mavlink_test_data_stream(system_id, component_id, last_msg);
  10270. mavlink_test_manual_control(system_id, component_id, last_msg);
  10271. mavlink_test_rc_channels_override(system_id, component_id, last_msg);
  10272. mavlink_test_mission_item_int(system_id, component_id, last_msg);
  10273. mavlink_test_vfr_hud(system_id, component_id, last_msg);
  10274. mavlink_test_command_int(system_id, component_id, last_msg);
  10275. mavlink_test_command_long(system_id, component_id, last_msg);
  10276. mavlink_test_command_ack(system_id, component_id, last_msg);
  10277. mavlink_test_manual_setpoint(system_id, component_id, last_msg);
  10278. mavlink_test_set_attitude_target(system_id, component_id, last_msg);
  10279. mavlink_test_attitude_target(system_id, component_id, last_msg);
  10280. mavlink_test_set_position_target_local_ned(system_id, component_id, last_msg);
  10281. mavlink_test_position_target_local_ned(system_id, component_id, last_msg);
  10282. mavlink_test_set_position_target_global_int(system_id, component_id, last_msg);
  10283. mavlink_test_position_target_global_int(system_id, component_id, last_msg);
  10284. mavlink_test_local_position_ned_system_global_offset(system_id, component_id, last_msg);
  10285. mavlink_test_hil_state(system_id, component_id, last_msg);
  10286. mavlink_test_hil_controls(system_id, component_id, last_msg);
  10287. mavlink_test_hil_rc_inputs_raw(system_id, component_id, last_msg);
  10288. mavlink_test_hil_actuator_controls(system_id, component_id, last_msg);
  10289. mavlink_test_optical_flow(system_id, component_id, last_msg);
  10290. mavlink_test_global_vision_position_estimate(system_id, component_id, last_msg);
  10291. mavlink_test_vision_position_estimate(system_id, component_id, last_msg);
  10292. mavlink_test_vision_speed_estimate(system_id, component_id, last_msg);
  10293. mavlink_test_vicon_position_estimate(system_id, component_id, last_msg);
  10294. mavlink_test_highres_imu(system_id, component_id, last_msg);
  10295. mavlink_test_optical_flow_rad(system_id, component_id, last_msg);
  10296. mavlink_test_hil_sensor(system_id, component_id, last_msg);
  10297. mavlink_test_sim_state(system_id, component_id, last_msg);
  10298. mavlink_test_radio_status(system_id, component_id, last_msg);
  10299. mavlink_test_file_transfer_protocol(system_id, component_id, last_msg);
  10300. mavlink_test_timesync(system_id, component_id, last_msg);
  10301. mavlink_test_camera_trigger(system_id, component_id, last_msg);
  10302. mavlink_test_hil_gps(system_id, component_id, last_msg);
  10303. mavlink_test_hil_optical_flow(system_id, component_id, last_msg);
  10304. mavlink_test_hil_state_quaternion(system_id, component_id, last_msg);
  10305. mavlink_test_scaled_imu2(system_id, component_id, last_msg);
  10306. mavlink_test_log_request_list(system_id, component_id, last_msg);
  10307. mavlink_test_log_entry(system_id, component_id, last_msg);
  10308. mavlink_test_log_request_data(system_id, component_id, last_msg);
  10309. mavlink_test_log_data(system_id, component_id, last_msg);
  10310. mavlink_test_log_erase(system_id, component_id, last_msg);
  10311. mavlink_test_log_request_end(system_id, component_id, last_msg);
  10312. mavlink_test_gps_inject_data(system_id, component_id, last_msg);
  10313. mavlink_test_gps2_raw(system_id, component_id, last_msg);
  10314. mavlink_test_power_status(system_id, component_id, last_msg);
  10315. mavlink_test_serial_control(system_id, component_id, last_msg);
  10316. mavlink_test_gps_rtk(system_id, component_id, last_msg);
  10317. mavlink_test_gps2_rtk(system_id, component_id, last_msg);
  10318. mavlink_test_scaled_imu3(system_id, component_id, last_msg);
  10319. mavlink_test_data_transmission_handshake(system_id, component_id, last_msg);
  10320. mavlink_test_encapsulated_data(system_id, component_id, last_msg);
  10321. mavlink_test_distance_sensor(system_id, component_id, last_msg);
  10322. mavlink_test_terrain_request(system_id, component_id, last_msg);
  10323. mavlink_test_terrain_data(system_id, component_id, last_msg);
  10324. mavlink_test_terrain_check(system_id, component_id, last_msg);
  10325. mavlink_test_terrain_report(system_id, component_id, last_msg);
  10326. mavlink_test_scaled_pressure2(system_id, component_id, last_msg);
  10327. mavlink_test_att_pos_mocap(system_id, component_id, last_msg);
  10328. mavlink_test_set_actuator_control_target(system_id, component_id, last_msg);
  10329. mavlink_test_actuator_control_target(system_id, component_id, last_msg);
  10330. mavlink_test_altitude(system_id, component_id, last_msg);
  10331. mavlink_test_resource_request(system_id, component_id, last_msg);
  10332. mavlink_test_scaled_pressure3(system_id, component_id, last_msg);
  10333. mavlink_test_follow_target(system_id, component_id, last_msg);
  10334. mavlink_test_control_system_state(system_id, component_id, last_msg);
  10335. mavlink_test_battery_status(system_id, component_id, last_msg);
  10336. mavlink_test_autopilot_version(system_id, component_id, last_msg);
  10337. mavlink_test_landing_target(system_id, component_id, last_msg);
  10338. mavlink_test_fence_status(system_id, component_id, last_msg);
  10339. mavlink_test_estimator_status(system_id, component_id, last_msg);
  10340. mavlink_test_wind_cov(system_id, component_id, last_msg);
  10341. mavlink_test_gps_input(system_id, component_id, last_msg);
  10342. mavlink_test_gps_rtcm_data(system_id, component_id, last_msg);
  10343. mavlink_test_high_latency(system_id, component_id, last_msg);
  10344. mavlink_test_high_latency2(system_id, component_id, last_msg);
  10345. mavlink_test_vibration(system_id, component_id, last_msg);
  10346. mavlink_test_home_position(system_id, component_id, last_msg);
  10347. mavlink_test_set_home_position(system_id, component_id, last_msg);
  10348. mavlink_test_message_interval(system_id, component_id, last_msg);
  10349. mavlink_test_extended_sys_state(system_id, component_id, last_msg);
  10350. mavlink_test_adsb_vehicle(system_id, component_id, last_msg);
  10351. mavlink_test_collision(system_id, component_id, last_msg);
  10352. mavlink_test_v2_extension(system_id, component_id, last_msg);
  10353. mavlink_test_memory_vect(system_id, component_id, last_msg);
  10354. mavlink_test_debug_vect(system_id, component_id, last_msg);
  10355. mavlink_test_named_value_float(system_id, component_id, last_msg);
  10356. mavlink_test_named_value_int(system_id, component_id, last_msg);
  10357. mavlink_test_statustext(system_id, component_id, last_msg);
  10358. mavlink_test_debug(system_id, component_id, last_msg);
  10359. mavlink_test_setup_signing(system_id, component_id, last_msg);
  10360. mavlink_test_button_change(system_id, component_id, last_msg);
  10361. mavlink_test_play_tune(system_id, component_id, last_msg);
  10362. mavlink_test_camera_information(system_id, component_id, last_msg);
  10363. mavlink_test_camera_settings(system_id, component_id, last_msg);
  10364. mavlink_test_storage_information(system_id, component_id, last_msg);
  10365. mavlink_test_camera_capture_status(system_id, component_id, last_msg);
  10366. mavlink_test_camera_image_captured(system_id, component_id, last_msg);
  10367. mavlink_test_flight_information(system_id, component_id, last_msg);
  10368. mavlink_test_mount_orientation(system_id, component_id, last_msg);
  10369. mavlink_test_logging_data(system_id, component_id, last_msg);
  10370. mavlink_test_logging_data_acked(system_id, component_id, last_msg);
  10371. mavlink_test_logging_ack(system_id, component_id, last_msg);
  10372. mavlink_test_video_stream_information(system_id, component_id, last_msg);
  10373. mavlink_test_video_stream_status(system_id, component_id, last_msg);
  10374. mavlink_test_wifi_config_ap(system_id, component_id, last_msg);
  10375. mavlink_test_protocol_version(system_id, component_id, last_msg);
  10376. mavlink_test_uavcan_node_status(system_id, component_id, last_msg);
  10377. mavlink_test_uavcan_node_info(system_id, component_id, last_msg);
  10378. mavlink_test_param_ext_request_read(system_id, component_id, last_msg);
  10379. mavlink_test_param_ext_request_list(system_id, component_id, last_msg);
  10380. mavlink_test_param_ext_value(system_id, component_id, last_msg);
  10381. mavlink_test_param_ext_set(system_id, component_id, last_msg);
  10382. mavlink_test_param_ext_ack(system_id, component_id, last_msg);
  10383. mavlink_test_obstacle_distance(system_id, component_id, last_msg);
  10384. mavlink_test_odometry(system_id, component_id, last_msg);
  10385. mavlink_test_trajectory_representation_waypoints(system_id, component_id, last_msg);
  10386. mavlink_test_trajectory_representation_bezier(system_id, component_id, last_msg);
  10387. mavlink_test_cellular_status(system_id, component_id, last_msg);
  10388. mavlink_test_isbd_link_status(system_id, component_id, last_msg);
  10389. mavlink_test_utm_global_position(system_id, component_id, last_msg);
  10390. mavlink_test_debug_float_array(system_id, component_id, last_msg);
  10391. mavlink_test_orbit_execution_status(system_id, component_id, last_msg);
  10392. mavlink_test_statustext_long(system_id, component_id, last_msg);
  10393. mavlink_test_smart_battery_info(system_id, component_id, last_msg);
  10394. mavlink_test_smart_battery_status(system_id, component_id, last_msg);
  10395. mavlink_test_actuator_output_status(system_id, component_id, last_msg);
  10396. mavlink_test_time_estimate_to_target(system_id, component_id, last_msg);
  10397. mavlink_test_tunnel(system_id, component_id, last_msg);
  10398. mavlink_test_onboard_computer_status(system_id, component_id, last_msg);
  10399. mavlink_test_play_tune_v2(system_id, component_id, last_msg);
  10400. mavlink_test_supported_tunes(system_id, component_id, last_msg);
  10401. mavlink_test_wheel_distance(system_id, component_id, last_msg);
  10402. mavlink_test_open_drone_id_basic_id(system_id, component_id, last_msg);
  10403. mavlink_test_open_drone_id_location(system_id, component_id, last_msg);
  10404. mavlink_test_open_drone_id_authentication(system_id, component_id, last_msg);
  10405. mavlink_test_open_drone_id_self_id(system_id, component_id, last_msg);
  10406. mavlink_test_open_drone_id_system(system_id, component_id, last_msg);
  10407. mavlink_test_open_drone_id_operator_id(system_id, component_id, last_msg);
  10408. mavlink_test_open_drone_id_message_pack(system_id, component_id, last_msg);
  10409. }
  10410. #ifdef __cplusplus
  10411. }
  10412. #endif // __cplusplus
  10413. #endif // COMMON_TESTSUITE_H