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

The static functions in the OOKwiz class provide the main controls for OOKwiz' functionality. Prefix them with OOKwiz:: to use them from your own code. More...

#include <OOKwiz.h>

Static Public Member Functions

static bool setup (bool skip_saved_defaults=false)
 Starts OOKwiz. Loads settings, initializes the radio and starts receiving if it finds the appropriate settings. More...
 
static bool loop ()
 To be called from your own loop() function. More...
 
static bool receive ()
 Tell OOKwiz to start receiving and processing packets. More...
 
static bool onReceive (void(*callback_function)(RawTimings, Pulsetrain, Meaning))
 Use this to supply your own function that will be called every time a packet is received. More...
 
static bool standby ()
 Sets radio standby mode, turning off reception. More...
 
static bool simulate (String &str)
 Pretends this string representation of a RawTimings, Pulsetrain or Meaning instance was just received by the radio. More...
 
static bool simulate (RawTimings &raw)
 Pretends this RawTimings instance was just received by the radio. More...
 
static bool simulate (Pulsetrain &train)
 Pretends this Pulsetrain instance was just received by the radio. More...
 
static bool simulate (Meaning &meaning)
 Pretends this Meaning instance was just received by the radio. More...
 
static bool transmit (String &str)
 Transmits this string representation of a RawTimings, Pulsetrain or Meaning instance. More...
 
static bool transmit (RawTimings &raw)
 Transmits this RawTimings instance. More...
 
static bool transmit (Pulsetrain &train)
 Transmits this Pulsetrain instance. More...
 
static bool transmit (Meaning &meaning)
 Transmits this Meaning instance. More...
 

Detailed Description

The static functions in the OOKwiz class provide the main controls for OOKwiz' functionality. Prefix them with OOKwiz:: to use them from your own code.

Example use of functions from the OOKwiz class

void setup() {
}
void loop() {
}
static bool loop()
To be called from your own loop() function.
Definition: OOKwiz.cpp:122
static bool setup(bool skip_saved_defaults=false)
Starts OOKwiz. Loads settings, initializes the radio and starts receiving if it finds the appropriate...
Definition: OOKwiz.cpp:42

Definition at line 59 of file OOKwiz.h.

Member Function Documentation

◆ setup()

bool OOKwiz::setup ( bool  skip_saved_defaults = false)
static

Starts OOKwiz. Loads settings, initializes the radio and starts receiving if it finds the appropriate settings.

If you set the GPIO pin for a button on your ESP32 in 'pin_rescue' and press it during boot, OOKwiz will not initialize SPI and the radio, possibly breaking an endless boot loop. Set 'rescue_active_high' if the button connects to VCC instead of GND.

Normally, OOKwiz will start up in receive mode. If you set 'start_in_standby', it will start in standby mode instead.

Parameters
skip_saved_defaultsThe settings in the SPIFFS file 'defaults' are not read when this is true, leaving only the factory defaults from config.cpp.
Returns
true if setup succeeded, false if it could not complete, e.g. because the radio is not configured yet.

Definition at line 42 of file OOKwiz.cpp.

◆ loop()

bool OOKwiz::loop ( )
static

To be called from your own loop() function.

Does the high-level processing of packets as soon as they are received and processed by the ISR functions. Handles the serial port output of each packet as well as calling the user's own callback function and the various device plugins.

Returns
always returns true

Definition at line 122 of file OOKwiz.cpp.

◆ receive()

bool OOKwiz::receive ( )
static

Tell OOKwiz to start receiving and processing packets.

OOKwiz starts in receive mode normally, so you would only need to call this if your code has turned off reception (with standby()) or if you configured OOKwiz to not start in receive mode by setting start_in_standby.

Returns
true if receive mode could be activated, false if not.

Definition at line 376 of file OOKwiz.cpp.

◆ onReceive()

bool OOKwiz::onReceive ( void(*)(RawTimings, Pulsetrain, Meaning callback_function)
static

Use this to supply your own function that will be called every time a packet is received.

The callback_function parameter has to be the function name of a function that takes the three packet representations as arguments and does not return anything. Here's an example sketch:

setup() {
Serial.begin(115200);
OOKwiz::onReceive(myReceiveFunction);
}
loop() {
}
void myReceiveFunction(RawTimings raw, Pulsetrain train, Meaning meaning) {
Serial.println("A packet was received and myReceiveFunction was called.");
}
Holds the parsed packet as a collection of MeaningElements.
Definition: Meaning.h:30
static bool onReceive(void(*callback_function)(RawTimings, Pulsetrain, Meaning))
Use this to supply your own function that will be called every time a packet is received.
Definition: OOKwiz.cpp:364
Instances of Pulsetrain represent packets in a normalized way, meaning all intervals of similar lengt...
Definition: Pulsetrain.h:24
RawTimings instances store the time in µs of each interval.
Definition: RawTimings.h:11

Make sure your own function is defined exactly as like this, even if you don't need all the parameters. You may change the names of the function and the parameters, but nothing else.

Parameters
callback_functionThe name of your own function, without parenthesis () after it.
Returns
always returns true

Definition at line 364 of file OOKwiz.cpp.

◆ standby()

bool OOKwiz::standby ( )
static

Sets radio standby mode, turning off reception.

Returns
The counterpart to receive(), turns off reception.

Definition at line 584 of file OOKwiz.cpp.

◆ simulate() [1/4]

bool OOKwiz::simulate ( String &  str)
static

Pretends this string representation of a RawTimings, Pulsetrain or Meaning instance was just received by the radio.

Parameters
strThe string representation of what needs to be simulated
Returns
true if it worked, false if not. Will show error message telling you why it didn't work in latter case.

Definition at line 400 of file OOKwiz.cpp.

◆ simulate() [2/4]

bool OOKwiz::simulate ( RawTimings raw)
static

Pretends this RawTimings instance was just received by the radio.

Parameters
rawthe instance to be simulated
Returns
true if it worked, false if not. Will show error message telling you why it didn't work in latter case.

Definition at line 425 of file OOKwiz.cpp.

◆ simulate() [3/4]

bool OOKwiz::simulate ( Pulsetrain train)
static

Pretends this Pulsetrain instance was just received by the radio.

Parameters
trainthe instance to be simulated
Returns
true if it worked, false if not. Will show error message telling you why it didn't work in latter case.

Definition at line 434 of file OOKwiz.cpp.

◆ simulate() [4/4]

bool OOKwiz::simulate ( Meaning meaning)
static

Pretends this Meaning instance was just received by the radio.

Parameters
meaningthe instance to be simulated
Returns
true if it worked, false if not. Will show error message telling you why it didn't work in latter case.

Definition at line 443 of file OOKwiz.cpp.

◆ transmit() [1/4]

bool OOKwiz::transmit ( String &  str)
static

Transmits this string representation of a RawTimings, Pulsetrain or Meaning instance.

Parameters
strThe string representation of what needs to be simulated
Returns
true if it worked, false if not. Will show error message telling you why it didn't work in latter case.

Definition at line 454 of file OOKwiz.cpp.

◆ transmit() [2/4]

bool OOKwiz::transmit ( RawTimings raw)
static

Transmits this RawTimings instance.

Parameters
rawthe instance to be transmitted
Returns
true if it worked, false if not. Will show error message telling you why it didn't work in latter case.

Definition at line 484 of file OOKwiz.cpp.

◆ transmit() [3/4]

bool OOKwiz::transmit ( Pulsetrain train)
static

Transmits this Pulsetrain instance.

Parameters
trainthe instance to be transmitted
Returns
true if it worked, false if not. Will show error message telling you why it didn't work in latter case.

Definition at line 527 of file OOKwiz.cpp.

◆ transmit() [4/4]

bool OOKwiz::transmit ( Meaning meaning)
static

Transmits this Meaning instance.

Parameters
meaningthe instance to be transmitted
Returns
true if it worked, false if not. Will show error message telling you why it didn't work in latter case.

Definition at line 574 of file OOKwiz.cpp.


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