TinyModem
Header-only software audio modem library
Loading...
Searching...
No Matches
tinymodem::ModemConfig Struct Reference

Configuration of the FSK modem. The fields correspond to the command line options of minimodem. Call setMode() to select one of the predefined baud modes ("1200", "300", "rtty", "tdd", "same", "callerid", "uic-train", "uic-ground", "V.21" or any number N for a Bell-like N bps modem) first and then change the individual fields. Fields which are left at 0 (or -1) are derived automatically when the encoder or decoder is started. More...

#include <ModemConfig.h>

Inheritance diagram for tinymodem::ModemConfig:
Collaboration diagram for tinymodem::ModemConfig:

Public Member Functions

 ModemConfig ()
bool setMode (const char *mode, bool keep_options=false)
bool isTxSupported () const
 Returns true if the selected format supports transmitting.
bool resolve ()
unsigned frameBits () const
 number of bits of a frame: start + data + stop bits
bool isResolved () const
 true after resolve() was called successfully

Public Attributes

float baud_rate = 1200.0f
 baud rate in bits per second (default: 1200 baud Bell 202)
float mark_freq = 0.0f
 mark frequency in Hz (0 = auto)
float space_freq = 0.0f
 space frequency in Hz (0 = auto)
float bandwidth = 0.0f
 receive filter bandwidth in Hz (0 = auto)
int data_bits = 0
 number of data bits per frame (0 = auto)
int start_bits = -1
 number of start bits (-1 = auto)
float stop_bits = -1.0f
 number of stop bits (-1 = auto)
bool invert_start_stop = false
 invert the start and stop bits
bool inverted = false
 swap the mark and space frequencies
bool msb_first = false
 transmit the most significant data bit first
bool rx_sync = false
 receiver: synchronize on sync_byte
int tx_sync_bytes = 0
 transmitter: number of sync bytes which are sent as preamble
long long sync_byte = -1
 sync byte value (-1 = none)
float confidence = 1.5f
 minimum confidence threshold (signal-to-noise squelch)
float search_limit = 2.3f
 stop searching for a better frame when this confidence was reached
bool auto_carrier = false
 automatically detect the carrier frequency
float auto_carrier_threshold = 0.001f
 minimum magnitude for the carrier auto detection
float volume = 1.0f
 transmit amplitude (0.0 - 1.0)
int leader_bits = 2
 number of mark bits which are sent before the first frame
int trailer_bits = 2
 number of mark bits which are sent after the last frame
bool rx_one = false
 receiver: stop after the first carrier was lost
bool binary_output = false
 receiver: output the data bits as '0'/'1' text
int binary_raw_bits = 0
 receiver: output n raw bits without framing (0 = disabled)
bool baudot_usos = true
 Baudot: unshift on space.
bool print_filter = false
 receiver: replace non printable characters with '.'
DataFormat format = DataFormat::ASCII
 data encoding
const char * expect_bits = nullptr
 custom expected frame pattern ('0','1','d')
uint8_t channel = 0
 receiver: input channel which is used for the decoding
float rx_noise = 0.0f
 receiver: (testing only) amplitude of added uniform noise
int buffer_divisor = 12
int autodetect_shift = 0
 derived: shift which is used for the carrier auto detection

Protected Member Functions

void resetMode ()

Static Protected Member Functions

static bool equalsIgnoreCase (const char *a, const char *b)
static bool startsWithIgnoreCase (const char *str, const char *prefix)

Protected Attributes

bool is_resolved = false

Detailed Description

Configuration of the FSK modem. The fields correspond to the command line options of minimodem. Call setMode() to select one of the predefined baud modes ("1200", "300", "rtty", "tdd", "same", "callerid", "uic-train", "uic-ground", "V.21" or any number N for a Bell-like N bps modem) first and then change the individual fields. Fields which are left at 0 (or -1) are derived automatically when the encoder or decoder is started.

Author
Phil Schatzmann (port), Kamal Mostafa (minimodem)

Constructor & Destructor Documentation

◆ ModemConfig()

tinymodem::ModemConfig::ModemConfig ( )
inline

Member Function Documentation

◆ equalsIgnoreCase()

bool tinymodem::ModemConfig::equalsIgnoreCase ( const char * a,
const char * b )
inlinestaticprotected

◆ frameBits()

unsigned tinymodem::ModemConfig::frameBits ( ) const
inline

number of bits of a frame: start + data + stop bits

◆ isResolved()

bool tinymodem::ModemConfig::isResolved ( ) const
inline

true after resolve() was called successfully

◆ isTxSupported()

bool tinymodem::ModemConfig::isTxSupported ( ) const
inline

Returns true if the selected format supports transmitting.

◆ resetMode()

void tinymodem::ModemConfig::resetMode ( )
inlineprotected

◆ resolve()

bool tinymodem::ModemConfig::resolve ( )
inline

Derives the missing parameters: returns false if the configuration is invalid. This is called automatically by the encoder and decoder.

◆ setMode()

bool tinymodem::ModemConfig::setMode ( const char * mode,
bool keep_options = false )
inline

Selects one of the predefined baud modes: returns false if invalid. All mode related fields (baud rate, frequencies, bandwidth, framing, sync, format) are reset first, so the result does not depend on a previous mode. With keep_options=true the data_bits and stop_bits which were set before are kept where minimodem allows options to override the mode (like the minimodem command line).

◆ startsWithIgnoreCase()

bool tinymodem::ModemConfig::startsWithIgnoreCase ( const char * str,
const char * prefix )
inlinestaticprotected

Member Data Documentation

◆ auto_carrier

bool tinymodem::ModemConfig::auto_carrier = false

automatically detect the carrier frequency

◆ auto_carrier_threshold

float tinymodem::ModemConfig::auto_carrier_threshold = 0.001f

minimum magnitude for the carrier auto detection

◆ autodetect_shift

int tinymodem::ModemConfig::autodetect_shift = 0

derived: shift which is used for the carrier auto detection

◆ bandwidth

float tinymodem::ModemConfig::bandwidth = 0.0f

receive filter bandwidth in Hz (0 = auto)

◆ baud_rate

float tinymodem::ModemConfig::baud_rate = 1200.0f

baud rate in bits per second (default: 1200 baud Bell 202)

◆ baudot_usos

bool tinymodem::ModemConfig::baudot_usos = true

Baudot: unshift on space.

◆ binary_output

bool tinymodem::ModemConfig::binary_output = false

receiver: output the data bits as '0'/'1' text

◆ binary_raw_bits

int tinymodem::ModemConfig::binary_raw_bits = 0

receiver: output n raw bits without framing (0 = disabled)

◆ buffer_divisor

int tinymodem::ModemConfig::buffer_divisor = 12

receiver: the sample buffer holds at least sample_rate / buffer_divisor samples (0 = use the minimum size)

◆ channel

uint8_t tinymodem::ModemConfig::channel = 0

receiver: input channel which is used for the decoding

◆ confidence

float tinymodem::ModemConfig::confidence = 1.5f

minimum confidence threshold (signal-to-noise squelch)

◆ data_bits

int tinymodem::ModemConfig::data_bits = 0

number of data bits per frame (0 = auto)

◆ expect_bits

const char* tinymodem::ModemConfig::expect_bits = nullptr

custom expected frame pattern ('0','1','d')

◆ format

DataFormat tinymodem::ModemConfig::format = DataFormat::ASCII

data encoding

◆ invert_start_stop

bool tinymodem::ModemConfig::invert_start_stop = false

invert the start and stop bits

◆ inverted

bool tinymodem::ModemConfig::inverted = false

swap the mark and space frequencies

◆ is_resolved

bool tinymodem::ModemConfig::is_resolved = false
protected

◆ leader_bits

int tinymodem::ModemConfig::leader_bits = 2

number of mark bits which are sent before the first frame

◆ mark_freq

float tinymodem::ModemConfig::mark_freq = 0.0f

mark frequency in Hz (0 = auto)

◆ msb_first

bool tinymodem::ModemConfig::msb_first = false

transmit the most significant data bit first

◆ print_filter

bool tinymodem::ModemConfig::print_filter = false

receiver: replace non printable characters with '.'

◆ rx_noise

float tinymodem::ModemConfig::rx_noise = 0.0f

receiver: (testing only) amplitude of added uniform noise

◆ rx_one

bool tinymodem::ModemConfig::rx_one = false

receiver: stop after the first carrier was lost

◆ rx_sync

bool tinymodem::ModemConfig::rx_sync = false

receiver: synchronize on sync_byte

◆ search_limit

float tinymodem::ModemConfig::search_limit = 2.3f

stop searching for a better frame when this confidence was reached

◆ space_freq

float tinymodem::ModemConfig::space_freq = 0.0f

space frequency in Hz (0 = auto)

◆ start_bits

int tinymodem::ModemConfig::start_bits = -1

number of start bits (-1 = auto)

◆ stop_bits

float tinymodem::ModemConfig::stop_bits = -1.0f

number of stop bits (-1 = auto)

◆ sync_byte

long long tinymodem::ModemConfig::sync_byte = -1

sync byte value (-1 = none)

◆ trailer_bits

int tinymodem::ModemConfig::trailer_bits = 2

number of mark bits which are sent after the last frame

◆ tx_sync_bytes

int tinymodem::ModemConfig::tx_sync_bytes = 0

transmitter: number of sync bytes which are sent as preamble

◆ volume

float tinymodem::ModemConfig::volume = 1.0f

transmit amplitude (0.0 - 1.0)


The documentation for this struct was generated from the following file: