Line data Source code
1 : #include "GCS.h" 2 : 3 : #include "AP_ServoRelayEvents/AP_ServoRelayEvents.h" 4 : 5 : #if AP_MAVLINK_SERVO_RELAY_ENABLED 6 : 7 823 : MAV_RESULT GCS_MAVLINK::handle_servorelay_message(const mavlink_command_int_t &packet) 8 : { 9 823 : AP_ServoRelayEvents *handler = AP::servorelayevents(); 10 823 : if (handler == nullptr) { 11 0 : return MAV_RESULT_UNSUPPORTED; 12 : } 13 : 14 823 : MAV_RESULT result = MAV_RESULT_FAILED; 15 : 16 823 : switch (packet.command) { 17 775 : case MAV_CMD_DO_SET_SERVO: 18 775 : if (handler->do_set_servo(packet.param1, packet.param2)) { 19 775 : result = MAV_RESULT_ACCEPTED; 20 : } 21 775 : break; 22 : 23 4 : case MAV_CMD_DO_REPEAT_SERVO: 24 4 : if (handler->do_repeat_servo(packet.param1, packet.param2, packet.param3, packet.param4 * 1000)) { 25 4 : result = MAV_RESULT_ACCEPTED; 26 : } 27 4 : break; 28 : 29 : #if AP_RELAY_ENABLED 30 40 : case MAV_CMD_DO_SET_RELAY: 31 40 : if (handler->do_set_relay(packet.param1, packet.param2)) { 32 40 : result = MAV_RESULT_ACCEPTED; 33 : } 34 40 : break; 35 : 36 4 : case MAV_CMD_DO_REPEAT_RELAY: 37 4 : if (handler->do_repeat_relay(packet.param1, packet.param2, packet.param3 * 1000)) { 38 4 : result = MAV_RESULT_ACCEPTED; 39 : } 40 4 : break; 41 : #endif 42 : 43 0 : default: 44 0 : result = MAV_RESULT_UNSUPPORTED; 45 0 : break; 46 : } 47 : 48 823 : return result; 49 : } 50 : 51 : #endif // AP_MAVLINK_SERVO_RELAY_ENABLED