5 changed files with 54 additions and 3 deletions
@ -0,0 +1,28 @@ |
|||
/*
|
|||
* dispatch.cpp |
|||
* |
|||
* Created on: 18 Jul 2021 |
|||
* Author: Andreas Berthoud |
|||
*/ |
|||
|
|||
#include "dispatch.hpp" |
|||
|
|||
#include "HeartbeatCommand.hpp" |
|||
#include "LedCommand.hpp" |
|||
|
|||
void handle_received_command(uint8_t command_id, uint8_t * payload_ptr, uint16_t size) { |
|||
|
|||
switch (command_id) |
|||
{ |
|||
case COMMAND_HEARTBEAT_REQUEST: |
|||
push_command(new HeartbeatRequest(payload_ptr, size)); |
|||
break; |
|||
case COMMAND_LED_REQUEST: |
|||
push_command(new LedRequest(payload_ptr, size)); |
|||
break; |
|||
|
|||
default: |
|||
break; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
/*
|
|||
* dispatch.hpp |
|||
* |
|||
* Created on: 18 Jul 2021 |
|||
* Author: Andreas Berthoud |
|||
*/ |
|||
|
|||
#ifndef DISPATCH_HPP_ |
|||
#define DISPATCH_HPP_ |
|||
|
|||
#include <stdint.h> |
|||
|
|||
extern "C" void handle_received_command(uint8_t command_id, uint8_t * payload_ptr, uint16_t length); |
|||
|
|||
#endif /* DISPATCH_HPP_ */ |
|||
Loading…
Reference in new issue