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.
48 lines
1.1 KiB
48 lines
1.1 KiB
/*
|
|
* dispatch.cpp
|
|
*
|
|
* Created on: 18 Jul 2021
|
|
* Author: Andreas Berthoud
|
|
*/
|
|
|
|
#include "dispatch.hpp"
|
|
|
|
#include "GPCommand.hpp"
|
|
#include "HeartbeatCommand.hpp"
|
|
#include "LedCommand.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
|
|
);
|
|
}
|
|
|