rtl433  UNKNOWN
RTL-433 utility
fileformat.h File Reference

Various utility functions handling file formats. More...

Go to the source code of this file.

Data Structures

struct  file_info_t
 

Enumerations

enum  file_type {
  F_UNSIGNED = 0 << 0, F_SIGNED = 1 << 0, F_INT = 0 << 1, F_FLOAT = 1 << 1,
  F_1CH = 1 << 4, F_2CH = 2 << 4, F_W8 = 8 << 8, F_W12 = 12 << 8,
  F_W16 = 16 << 8, F_W32 = 32 << 8, F_W64 = 64 << 8, F_I = 1 << 16,
  F_Q = 2 << 16, F_AM = 3 << 16, F_FM = 4 << 16, F_IQ = F_I | F_Q << 4,
  F_LOGIC = 5 << 16, F_VCD = 6 << 16, F_OOK = 7 << 16, F_U8 = F_1CH | F_UNSIGNED | F_INT | F_W8,
  F_S8 = F_1CH | F_SIGNED | F_INT | F_W8, F_CU8 = F_2CH | F_UNSIGNED | F_INT | F_W8, F_CS8 = F_2CH | F_SIGNED | F_INT | F_W8, F_U16 = F_1CH | F_UNSIGNED | F_INT | F_W16,
  F_S16 = F_1CH | F_SIGNED | F_INT | F_W16, F_CU16 = F_2CH | F_UNSIGNED | F_INT | F_W16, F_CS16 = F_2CH | F_SIGNED | F_INT | F_W16, F_U32 = F_1CH | F_UNSIGNED | F_INT | F_W32,
  F_S32 = F_1CH | F_SIGNED | F_INT | F_W32, F_CU32 = F_2CH | F_UNSIGNED | F_INT | F_W32, F_CS32 = F_2CH | F_SIGNED | F_INT | F_W32, F_F32 = F_1CH | F_SIGNED | F_FLOAT | F_W32,
  F_CF32 = F_2CH | F_SIGNED | F_FLOAT | F_W32, CU8_IQ = F_CU8 | F_IQ, CS8_IQ = F_CS8 | F_IQ, S16_AM = F_S16 | F_AM,
  S16_FM = F_S16 | F_FM, CS16_IQ = F_CS16 | F_IQ, CF32_IQ = F_CF32 | F_IQ, F32_AM = F_F32 | F_AM,
  F32_FM = F_F32 | F_FM, F32_I = F_F32 | F_I, F32_Q = F_F32 | F_Q, U8_LOGIC = F_LOGIC | F_U8,
  VCD_LOGIC = F_VCD, PULSE_OOK = F_OOK
}
 a single handy number to define the file type. More...
 

Functions

char const * file_basename (char const *path)
 
int parse_file_info (const char *filename, file_info_t *info)
 This will detect file info and overrides. More...
 
void check_read_file_info (file_info_t *info)
 
void check_write_file_info (file_info_t *info)
 
char const * file_info_string (file_info_t *info)
 

Detailed Description

Various utility functions handling file formats.

Copyright (C) 2018 Christian Zuckschwerdt

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Enumeration Type Documentation

◆ file_type

enum file_type

a single handy number to define the file type.

bitmask: RRRR LLLL WWWWWWWW 00CC 00FS

Enumerator
F_UNSIGNED 
F_SIGNED 
F_INT 
F_FLOAT 
F_1CH 
F_2CH 
F_W8 
F_W12 
F_W16 
F_W32 
F_W64 
F_I 
F_Q 
F_AM 
F_FM 
F_IQ 
F_LOGIC 
F_VCD 
F_OOK 
F_U8 
F_S8 
F_CU8 
F_CS8 
F_U16 
F_S16 
F_CU16 
F_CS16 
F_U32 
F_S32 
F_CU32 
F_CS32 
F_F32 
F_CF32 
CU8_IQ 
CS8_IQ 
S16_AM 
S16_FM 
CS16_IQ 
CF32_IQ 
F32_AM 
F32_FM 
F32_I 
F32_Q 
U8_LOGIC 
VCD_LOGIC 
PULSE_OOK 

Function Documentation

◆ check_read_file_info()

void check_read_file_info ( file_info_t info)

◆ check_write_file_info()

void check_write_file_info ( file_info_t info)

◆ file_basename()

char const* file_basename ( char const *  path)

Referenced by data_acquired_handler().

◆ file_info_string()

char const* file_info_string ( file_info_t info)

◆ parse_file_info()

int parse_file_info ( char const *  filename,
file_info_t info 
)

This will detect file info and overrides.

Parse "[0-9]+(\.[0-9]+)?[A-Za-z]" as frequency (suffix "M" or "[kMG]?Hz") or sample rate (suffix "k" or "[kMG]?sps")

Parse "[A-Za-z][0-9A-Za-z]+" as format or content specifier:

2ch formats: "cu8", "cs8", "cs16", "cs32", "cf32" 1ch formats: "u8", "s8", "s16", "u16", "s32", "u32", "f32" text formats: "vcd", "ook" content types: "iq", "i", "q", "am", "fm", "logic"

Parses left to right, with the exception of a prefix up to the last colon ":" This prefix is the forced override, parsed last and removed from the filename.

All matches are case-insensitive.

default detection, e.g.: path/filename.am.s16 overrides, e.g.: am:s16:path/filename.ext other styles are detected but discouraged, e.g.: am-s16:path/filename.ext, am.s16:path/filename.ext, path/filename.am_s16

References file_type(), file_type_guess_auto_format(), file_info_t::format, last_plain_colon(), file_info_t::path, file_info_t::raw_format, and file_info_t::spec.

Referenced by add_dumper(), assert_file_type(), and main().