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
Pulsetrain Class Reference

Instances of Pulsetrain represent packets in a normalized way, meaning all intervals of similar length are made equal. More...

#include <Pulsetrain.h>

Public Member Functions

 operator bool ()
 If you try to evaluate the instance as a bool (e.g. if (myPulsetrain) ...) this will be true if there's transitions stored. More...
 
void zap ()
 empty out all information about the stored pulses More...
 
bool sameAs (const Pulsetrain &other_train)
 Compare to other Pulsetrains to see if same packet. Ignores minor timing differences. Used internally by ISR processing to see if packet is a repeat. More...
 
bool fromRawTimings (const RawTimings &raw)
 Convert RawTimings to Pulsetrain. More...
 
RawTimings toRawTimings ()
 Pulsetrain to RawTimings. More...
 
bool fromMeaning (const Meaning &meaning)
 
Meaning toMeaning ()
 Pulsetrain to Meaning. More...
 
String summary () const
 Summary String a la 25 pulses over 24287 µs, repeated 6 times with gaps of 132 µs More...
 
bool fromString (String in)
 Read a String representation like above, and store in this instance. More...
 
String toString () const
 Get the String representation, which looks like 2010101100110101001101010010110011001100101100101,190,575,5906*6@132 More...
 
String binList ()
 Get information about the bins in this Pulsetrain, such as lowest, average and highest interval as well as number of pulses in each bin. More...
 
String visualizer ()
 Returns the viasualizer (the blocky time-graph) for the pulses in this Pulsetrain instance. More...
 
String visualizer (int base)
 The visualizer like above, with base taken from visualizer_pixel setting. More...
 

Static Public Member Functions

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

Public Attributes

std::vector< pulseBinbins
 std::vector with the bins, each a PulseBin struct More...
 
std::vector< uint8_t > transitions
 std::vector with the transitions, each merely the pulsebin that transition is in More...
 
uint32_t duration = 0
 Total duration of this Pulsetrain in µs. More...
 
int64_t first_at = 0
 First seen at this time, in system microseconds. More...
 
int64_t last_at = 0
 Last seen at this time, in system microseconds. More...
 
uint16_t repeats = 0
 Number of repetitions detected before either another packet came or repeat_timeout µs elapsed. More...
 
uint16_t gap = 0
 Smallest gap between repeated transmissions. More...
 

Detailed Description

Instances of Pulsetrain represent packets in a normalized way, meaning all intervals of similar length are made equal.

Definition at line 24 of file Pulsetrain.h.

Member Function Documentation

◆ maybe()

bool Pulsetrain::maybe ( String  str)
static

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

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

Definition at line 15 of file Pulsetrain.cpp.

◆ operator bool()

IRAM_ATTR Pulsetrain::operator bool ( )

If you try to evaluate the instance as a bool (e.g. if (myPulsetrain) ...) this will be true if there's transitions stored.

Definition at line 29 of file Pulsetrain.cpp.

◆ zap()

void IRAM_ATTR Pulsetrain::zap ( )

empty out all information about the stored pulses

Definition at line 34 of file Pulsetrain.cpp.

◆ sameAs()

bool IRAM_ATTR Pulsetrain::sameAs ( const Pulsetrain other_train)

Compare to other Pulsetrains to see if same packet. Ignores minor timing differences. Used internally by ISR processing to see if packet is a repeat.

Parameters
other_trainPulsetrain we're comparing this one to
Returns
true if same, false if not

Definition at line 45 of file Pulsetrain.cpp.

◆ fromRawTimings()

bool IRAM_ATTR Pulsetrain::fromRawTimings ( const RawTimings raw)

Convert RawTimings to Pulsetrain.

Parameters
rawthe RawTimings instance to convert from
Returns
Always true

Definition at line 168 of file Pulsetrain.cpp.

◆ toRawTimings()

RawTimings Pulsetrain::toRawTimings ( )

Pulsetrain to RawTimings.

Returns
RawTimings instance

Definition at line 213 of file Pulsetrain.cpp.

◆ fromMeaning()

bool Pulsetrain::fromMeaning ( const Meaning meaning)

Definition at line 274 of file Pulsetrain.cpp.

◆ toMeaning()

Meaning Pulsetrain::toMeaning ( )

Pulsetrain to Meaning.

Returns
Meaning instance

Definition at line 375 of file Pulsetrain.cpp.

◆ summary()

String Pulsetrain::summary ( ) const

Summary String a la 25 pulses over 24287 µs, repeated 6 times with gaps of 132 µs

Returns
the String in question

Definition at line 156 of file Pulsetrain.cpp.

◆ fromString()

bool Pulsetrain::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 87 of file Pulsetrain.cpp.

◆ toString()

String Pulsetrain::toString ( ) const

Get the String representation, which looks like 2010101100110101001101010010110011001100101100101,190,575,5906*6@132

Returns
the String representation

Definition at line 67 of file Pulsetrain.cpp.

◆ binList()

String Pulsetrain::binList ( )

Get information about the bins in this Pulsetrain, such as lowest, average and highest interval as well as number of pulses in each bin.

Returns
multi-line String with bin information, 5 columns with header

Definition at line 221 of file Pulsetrain.cpp.

◆ visualizer() [1/2]

String Pulsetrain::visualizer ( )

Returns the viasualizer (the blocky time-graph) for the pulses in this Pulsetrain instance.

Parameters
baseµs per (half-character) block. Every interval gets at least one block so all pulses are guaranteed visible
Returns
visualizer String

Definition at line 233 of file Pulsetrain.cpp.

◆ visualizer() [2/2]

String Pulsetrain::visualizer ( int  base)

The visualizer like above, with base taken from visualizer_pixel setting.

Returns
visualizer String

Definition at line 241 of file Pulsetrain.cpp.

Member Data Documentation

◆ bins

std::vector<pulseBin> Pulsetrain::bins

std::vector with the bins, each a PulseBin struct

Definition at line 29 of file Pulsetrain.h.

◆ transitions

std::vector<uint8_t> Pulsetrain::transitions

std::vector with the transitions, each merely the pulsebin that transition is in

Definition at line 31 of file Pulsetrain.h.

◆ duration

uint32_t Pulsetrain::duration = 0

Total duration of this Pulsetrain in µs.

Definition at line 33 of file Pulsetrain.h.

◆ first_at

int64_t Pulsetrain::first_at = 0

First seen at this time, in system microseconds.

Definition at line 35 of file Pulsetrain.h.

◆ last_at

int64_t Pulsetrain::last_at = 0

Last seen at this time, in system microseconds.

Definition at line 37 of file Pulsetrain.h.

◆ repeats

uint16_t Pulsetrain::repeats = 0

Number of repetitions detected before either another packet came or repeat_timeout µs elapsed.

Definition at line 39 of file Pulsetrain.h.

◆ gap

uint16_t Pulsetrain::gap = 0

Smallest gap between repeated transmissions.

Definition at line 41 of file Pulsetrain.h.


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