Files
fluxengine/lib/fluxmap.h
David Given 5ce2acdfb4 The new decoder architecture now works, at least for the FB100. All I need now
is to rewrite every single other decoder.
2019-04-18 00:47:28 +02:00

48 lines
1.0 KiB
C++

#ifndef FLUXMAP_H
#define FLUXMAP_H
#include "bytes.h"
class RawBits;
class Fluxmap
{
public:
nanoseconds_t duration() const { return _duration; }
size_t bytes() const { return _bytes.size(); }
const Bytes& rawBytes() const { return _bytes; }
const uint8_t* ptr() const
{
if (!_bytes.empty())
return &_bytes[0];
return NULL;
}
Fluxmap& appendInterval(uint32_t ticks);
Fluxmap& appendPulse();
Fluxmap& appendIndex();
Fluxmap& appendBytes(const Bytes& bytes);
Fluxmap& appendBytes(const uint8_t* ptr, size_t len);
Fluxmap& appendByte(uint8_t byte)
{
return appendBytes(&byte, 1);
}
nanoseconds_t guessClock() const;
const RawBits decodeToBits(nanoseconds_t clock_period) const;
Fluxmap& appendBits(const std::vector<bool>& bits, nanoseconds_t clock);
void precompensate(int threshold_ticks, int amount_ticks);
private:
nanoseconds_t _duration = 0;
int _ticks = 0;
Bytes _bytes;
};
#endif