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

/*
* PumpCommand.hpp
*
* Created on: Jul 27, 2021
* Author: Andreas Berthoud
*/
#ifndef PUMPCOMMAND_HPP_
#define PUMPCOMMAND_HPP_
#include "Request.hpp"
#include "Response.hpp"
class PumpResponse : public Response {
public:
PumpResponse(com_channel_type_t com_channel_type, uint16_t response_identifier, bool was_successful, bool is_on);
CommandId get_command_id() override { return COMMAND_PUMP_RESPONSE; }
private:
bool was_successful = false;
bool is_on = false;
};
class PumpRequest : public Request {
public:
PumpRequest(com_channel_type_t com_channel_type, uint8_t * payload_ptr, uint16_t size);
PumpResponse * execute_request(com_channel_type_t com_channel_type, uint16_t response_identifier) override;
CommandId get_command_id() override { return COMMAND_PUMP_REQUEST; }
private:
enum PumpCommand {
pump_command_turn_on,
pump_command_turn_off,
pump_command_get_state,
pump_command_max,
};
bool has_error = false;
PumpCommand pump_command = pump_command_turn_off;
uint16_t timeout; /* timeout in seconds until the pump is turned off again */
};
#endif /* PUMPCOMMAND_HPP_ */