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.
 
 

46 lines
1.0 KiB

/*
* GPCommand.hpp
*
* Created on: Jul 18, 2021
* Author: Andreas Berthoud
*/
#ifndef GPCOMMAND_HPP_
#define GPCOMMAND_HPP_
#include "Request.hpp"
#include "Response.hpp"
class GPResponse : public Response {
public:
GPResponse(com_channel_type_t com_channel_type, uint16_t response_identifier, bool was_successful);
CommandId get_command_id() override { return COMMAND_GP_RESPONSE; }
private:
bool was_successful = false;
};
class GPRequest : public Request {
public:
/**
* @brief Construct a new general purpose request object
*
* @param payload_ptr
* HEADER | command_id |
* | 1 byte |
*
* @param size
*/
GPRequest(com_channel_type_t com_channel_type, uint8_t * payload_ptr, uint16_t size);
GPResponse * execute_request(com_channel_type_t com_channel_type, uint16_t response_identifier) override;
CommandId get_command_id() override { return COMMAND_GP_REQUEST; }
private:
bool has_error = false;
int command_id = 0;
};
#endif /* GPCOMMAND_HPP_ */