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.
 
 

39 lines
913 B

/*
* Notification.hpp
*
* Created on: Jul 14, 2021
* Author: Andreas Berthoud
*/
#ifndef NOTIFICATION_HPP_
#define NOTIFICATION_HPP_
#include "Command.hpp"
#define BUFFER_SIZE (512)
#define NOTIFICATION_COMMAND_HEADER_SIZE (4)
#define NOTIFICATION_COMMAND_STOP_BYTE_SIZE (1)
#define NOTIFICATION_COMMAND_TOTAL_OVERHEAD (NOTIFICATION_COMMAND_HEADER_SIZE + NOTIFICATION_COMMAND_STOP_BYTE_SIZE)
#define NOTIFICATION_COMMAND_FREE_BUFFER (BUFFER_SIZE - NOTIFICATION_COMMAND_TOTAL_OVERHEAD)
class Notification: public Command {
public:
Notification(com_channel_type_t com_channel_type);
virtual ~Notification() {};
bool execute() override;
uint16_t get_payload_size();
void add_to_payload_size(uint16_t size);
protected:
uint8_t * payload_ptr;
private:
uint16_t payload_size = 0;
uint8_t data[BUFFER_SIZE];
com_channel_type_t com_channel_type;
};
#endif /* NOTIFICATION_HPP_ */