Solar/cb_frame.h
2025-08-23 16:59:05 +02:00

47 lines
1.7 KiB
C++

#ifndef __SOLAR_CB_FRAME // include GUARD
#define __SOLAR_CB_FRAME
#include "esphome.h"
#include <utility>
#include "common.h"
using namespace esphome;
namespace solar
{
class cbf_store;
class cb_frame {
public:
enum cbf_store_sortcolumns : int
{
sisortNULL,
sisortcanid,
sisortframe,
sisortrtr,
sisortmsgid,
sisortEND,
sisortcase = SORTCASE, // case sensitive
sisortreverse = SORTREVERSE, // reverse order
sisortwild = WILDNULL, // an empty, or null entry equates to wildcard
sistopcomparecol = STOPCOMPARE // stop compare after this column if both items to be compared are valid and a compare was possible
};
int msg_id;
bool rtr;
uint32_t can_id;
byte_vector frame;
cb_frame() = default;
cb_frame(int msg_id, uint32_t can_id);
cb_frame(int msg_id, uint32_t can_id, const byte_vector& _frame, bool _rtr);
void clear();
void swap(cb_frame &s);
virtual bool is_valid() const;
virtual int compare(const cb_frame& b, const int *comparecolumns) const;
virtual int compare(const cb_frame &b, int cmpflag, bool *stopcomparesignal, bool validnextcol) const;
int compare_frame(const byte_vector& _frame) const;
virtual std::string tag(const std::string& prefix = "") const;
virtual std::string to_string() const;
virtual ~cb_frame() = default;
// using default (compiler auto generated) copy and move constructors and assignment operators
};
} // namespace solar
#endif // __SOLAR_CB_FRAME