OOKwiz
on/off-keying for ESP32 and a variety of supported radio modules
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Meaning Class Reference

Holds the parsed packet as a collection of MeaningElements. More...

#include <Meaning.h>

Public Member Functions

 operator bool ()
 If you try to evaluate the instance as a bool, for instance in if (myMeaning) ..., it will be true if this holds Meaning elements. More...
 
void zap ()
 empty out all Meaning elements More...
 
bool fromPulsetrain (Pulsetrain &train)
 Convert Pulsetrain to Meaning. More...
 
Pulsetrain toPulsetrain ()
 Meaning to Pulsetrain. More...
 
bool addPulse (uint16_t pulse_time)
 Adds a "pulse" Meaning element. More...
 
bool addGap (uint16_t pulse_time)
 Adds a "gap"" Meaning element. More...
 
bool addPWM (int space, int mark, int bits, uint8_t *tmp_data)
 Adds a new meaning element with the specified PWM-encoded data. More...
 
bool addPPM (int space, int mark, int filler, int bits, uint8_t *tmp_data)
 Adds a new meaning element with the specified PPM-encoded data. More...
 
String toString ()
 Get the String representation, which looks like pulse(5906) + pwm(timing 190/575, 24 bits 0x1772A4) More...
 
bool fromString (String in)
 Read a String representation like above, and store in this instance. More...
 
int parsePWM (const Pulsetrain &train, int from, int to, int space, int mark)
 Decode PWM data with specified timings from given range in Pulsetrain to a new Meaning element. Normally called by fromPulsetrain, but can be used from user code also. More...
 
int parsePPM (const Pulsetrain &train, int from, int to, int space, int mark, int filler)
 Decode PPM data with specified timings from given range in Pulsetrain to a new Meaning element. Normally called by fromPulsetrain, but can be used from user code also. More...
 

Static Public Member Functions

static bool maybe (String str)
 See if String might be a representation of Maening. No guarantees until you try to convert it, but silent. More...
 

Public Attributes

std::vector< MeaningElementelements
 The MeaningElement structs that make up the parsed packet. More...
 
bool suspected_incomplete = false
 Set when there were no repetitions and the number of bits detected is not divisible by 4. More...
 
uint16_t repeats = 0
 Number of repeats of the signal. More...
 
uint16_t gap = 0
 Shortest time between two repetitions. More...
 

Detailed Description

Holds the parsed packet as a collection of MeaningElements.

Definition at line 30 of file Meaning.h.

Member Function Documentation

◆ maybe()

bool Meaning::maybe ( String  str)
static

See if String might be a representation of Maening. No guarantees until you try to convert it, but silent.

Parameters
strString that we are curious about
Returns
true if it might be a Meaning String, false if not.

Definition at line 14 of file Meaning.cpp.

◆ operator bool()

Meaning::operator bool ( )

If you try to evaluate the instance as a bool, for instance in if (myMeaning) ..., it will be true if this holds Meaning elements.

Definition at line 23 of file Meaning.cpp.

◆ zap()

void Meaning::zap ( )

empty out all Meaning elements

Definition at line 28 of file Meaning.cpp.

◆ fromPulsetrain()

bool Meaning::fromPulsetrain ( Pulsetrain train)

Convert Pulsetrain to Meaning.

Parameters
trainPulsetrain we want to convert
Returns
true if there was data found, false otherwise.

Definition at line 37 of file Meaning.cpp.

◆ toPulsetrain()

Pulsetrain Meaning::toPulsetrain ( )

Meaning to Pulsetrain.

Returns
Pulsetrain instance

Definition at line 234 of file Meaning.cpp.

◆ addPulse()

bool Meaning::addPulse ( uint16_t  pulse_time)

Adds a "pulse" Meaning element.

Parameters
pulse_timetime in µs
Returns
true

Definition at line 392 of file Meaning.cpp.

◆ addGap()

bool Meaning::addGap ( uint16_t  gap_time)

Adds a "gap"" Meaning element.

Parameters
gap_timetime in µs
Returns
true

Definition at line 403 of file Meaning.cpp.

◆ addPWM()

bool Meaning::addPWM ( int  space,
int  mark,
int  bits,
uint8_t *  tmp_data 
)

Adds a new meaning element with the specified PWM-encoded data.

Parameters
spacetime in µs
marktime in µs
bitsLength of data at tmp_data IN BITS, not bytes
tmp_datapointer to uint8_t array with the data
Returns
true

Definition at line 439 of file Meaning.cpp.

◆ addPPM()

bool Meaning::addPPM ( int  space,
int  mark,
int  filler,
int  bits,
uint8_t *  tmp_data 
)

Adds a new meaning element with the specified PPM-encoded data.

Parameters
spacetime in µs
marktime in µs
fillertime in µs
bitsLength of data at tmp_data IN BITS, not bytes
tmp_datapointer to uint8_t array with the data
Returns
true

Definition at line 418 of file Meaning.cpp.

◆ toString()

String Meaning::toString ( )

Get the String representation, which looks like pulse(5906) + pwm(timing 190/575, 24 bits 0x1772A4)

Returns
the String representation

Definition at line 242 of file Meaning.cpp.

◆ fromString()

bool Meaning::fromString ( String  in)

Read a String representation like above, and store in this instance.

Returns
true if it worked, false (with error message) if it didn't.

Definition at line 281 of file Meaning.cpp.

◆ parsePWM()

int Meaning::parsePWM ( const Pulsetrain train,
int  from,
int  to,
int  space,
int  mark 
)

Decode PWM data with specified timings from given range in Pulsetrain to a new Meaning element. Normally called by fromPulsetrain, but can be used from user code also.

Parameters
trainPulsetrain we're reading from
fromstart at this interval
toend before this interval
spacebin number (NOT time in µs) for space (first if bit 0)
markbin number (NOT time in µs) for mark (first if bit 1)
Returns
Number of intervals read before read error (mark-mark, space-space or bin number not mark or space)

Definition at line 135 of file Meaning.cpp.

◆ parsePPM()

int Meaning::parsePPM ( const Pulsetrain train,
int  from,
int  to,
int  space,
int  mark,
int  filler 
)

Decode PPM data with specified timings from given range in Pulsetrain to a new Meaning element. Normally called by fromPulsetrain, but can be used from user code also.

Parameters
trainPulsetrain we're reading from
fromstart at this interval
toend before this interval
spacebin number (NOT time in µs) for space (first if bit 0)
markbin number (NOT time in µs) for mark (first if bit 1)
fillerbin number for delineator interval between the mark and space intervals
Returns
Number of intervals read before read error

Definition at line 184 of file Meaning.cpp.

Member Data Documentation

◆ elements

std::vector<MeaningElement> Meaning::elements

The MeaningElement structs that make up the parsed packet.

Definition at line 33 of file Meaning.h.

◆ suspected_incomplete

bool Meaning::suspected_incomplete = false

Set when there were no repetitions and the number of bits detected is not divisible by 4.

Definition at line 35 of file Meaning.h.

◆ repeats

uint16_t Meaning::repeats = 0

Number of repeats of the signal.

Definition at line 37 of file Meaning.h.

◆ gap

uint16_t Meaning::gap = 0

Shortest time between two repetitions.

Definition at line 39 of file Meaning.h.


The documentation for this class was generated from the following files: