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.
 
 

38 lines
735 B

/*
* Command.hpp
*
* Created on: Jul 8, 2021
* Author: Andreas Berthoud
*/
#ifndef SRC_COMMAND_H_
#define SRC_COMMAND_H_
#include <stdint.h>
extern "C" void pop_and_execute_commands();
extern "C" void handle_received_command(uint8_t command_id, uint8_t * payload_ptr, uint16_t length);
typedef enum : uint8_t {
COMMAND_NONE = 0,
COMMAND_LOG = 0x1,
COMMAND_HEARTBEAT_REQUEST = 0x2,
COMMAND_HEARTBEAT_RESPONSE = 0x3,
COMMAND_LED_REQUEST = 0x4,
COMMAND_LED_RESPONSE = 0x5,
} CommandId;
class Command {
public:
CommandId id;
virtual ~Command() {};
virtual CommandId get_command_id() = 0;
virtual bool execute() = 0;
};
void push_command(Command * command);
#endif /* SRC_COMMAND_H_ */