/* * dispatch.cpp * * Created on: 18 Jul 2021 * Author: Andreas Berthoud */ #include "dispatch.hpp" #include "HeartbeatCommand.hpp" #include "LedCommand.hpp" #include "GPCommand.hpp" void handle_received_command(uint8_t command_id, uint8_t * payload_ptr, uint16_t size, com_channel_type_t com_channel_type ) { switch (command_id) { case COMMAND_HEARTBEAT_REQUEST: push_command(new HeartbeatRequest(com_channel_type, payload_ptr, size)); break; case COMMAND_LED_REQUEST: push_command(new LedRequest(com_channel_type, payload_ptr, size)); break; case COMMAND_GP_REQUEST: push_command(new GPRequest(com_channel_type, payload_ptr, size)); break; default: break; } } void handle_received_usb_command(uint8_t command_id, uint8_t * payload_ptr, uint16_t size) { handle_received_command( command_id, payload_ptr, size, com_channel_type_usb ); } void handle_received_ble_command(uint8_t command_id, uint8_t * payload_ptr, uint16_t size) { handle_received_command( command_id, payload_ptr, size, com_channel_type_ble ); }