(connpath)
| 8 | |
| 9 | @with_sitl |
| 10 | def test_115(connpath): |
| 11 | v = connect(connpath, wait_ready=True) |
| 12 | |
| 13 | # Dummy callback |
| 14 | def mavlink_callback(*args): |
| 15 | mavlink_callback.count += 1 |
| 16 | |
| 17 | mavlink_callback.count = 0 |
| 18 | |
| 19 | # Set the callback. |
| 20 | v.add_message_listener('*', mavlink_callback) |
| 21 | |
| 22 | # Change the vehicle into STABILIZE mode |
| 23 | v.mode = VehicleMode("STABILIZE") |
| 24 | # NOTE wait crudely for ACK on mode update |
| 25 | time.sleep(3) |
| 26 | |
| 27 | # Expect the callback to have been called |
| 28 | assert mavlink_callback.count > 0 |
| 29 | |
| 30 | # Unset the callback. |
| 31 | v.remove_message_listener('*', mavlink_callback) |
| 32 | savecount = mavlink_callback.count |
| 33 | |
| 34 | # Disarm. A callback of None should not throw errors |
| 35 | v.armed = False |
| 36 | # NOTE wait crudely for ACK on mode update |
| 37 | time.sleep(3) |
| 38 | |
| 39 | # Expect the callback to have been called |
| 40 | assert_equals(savecount, mavlink_callback.count) |
| 41 | |
| 42 | # Re-arm should not throw errors. |
| 43 | v.armed = True |
| 44 | # NOTE wait crudely for ACK on mode update |
| 45 | time.sleep(3) |
| 46 | |
| 47 | v.close() |
nothing calls this directly
no test coverage detected