libdata-gcf  1.1.2
Data Structures | Enumerations | Functions
Header parsing.

Data Structures

struct  gcf_generic_hdr
 Generic header details shared by all GCF blocks. More...
 
struct  gcf_data_hdr
 Header details for a data block. More...
 
struct  gcf_status_hdr
 Header details for a status block. More...
 
union  gcf_union_hdr
 Header union type for parsing. More...
 

Enumerations

enum  gcf_block_type_t {
  gcf_block_type_data , gcf_block_type_status , gcf_block_type_unified_status , gcf_block_type_strong_motion ,
  gcf_block_type_cd_status
}
 Possible block types. More...
 
enum  gcf_digitiser_t { gcf_digitiser_unknown , gcf_digitiser_dm24mk3 , gcf_digitiser_cd24 , gcf_digitiser_das }
 Possible digitiser types. More...
 
enum  gcf_variable_gain_t {
  gcf_no_variable_gain , gcf_variable_gain_times_one , gcf_variable_gain_times_two , gcf_variable_gain_times_four ,
  gcf_variable_gain_times_eight , gcf_variable_gain_times_sixteen , gcf_variable_gain_times_thirtytwo , gcf_variable_gain_times_sixtyfour
}
 Possible variable gain values. More...
 
enum  gcf_sample_format_t { gcf_sample_format_32bit_diff , gcf_sample_format_24bit_diff_mod , gcf_sample_format_16bit_diff , gcf_sample_format_8bit_diff }
 Possible sample formats. More...
 

Functions

int gcf_parse_hdr (const char *data, int len, union gcf_union_hdr *hdr)
 Parse header. More...
 

Detailed Description

The gcf_parse_hdr() routine and associated data types are used to parse the header of a GCF block. This must be done before it is possible to extract the contents of the block itself.

Enumeration Type Documentation

◆ gcf_block_type_t

Possible block types.

This enumeration contains all the possible block types. It is set in the type field of the various different header structures.

Enumerator
gcf_block_type_data 

Data block. Uses struct gcf_data_hdr.

gcf_block_type_status 

Status block. Uses struct gcf_status_hdr.

gcf_block_type_unified_status 

Unified status block. Uses struct gcf_status_hdr.

gcf_block_type_strong_motion 

Strong motion block. Uses struct gcf_status_hdr.

gcf_block_type_cd_status 

Continuous data status block. Uses struct gcf_generic_hdr.

◆ gcf_digitiser_t

Possible digitiser types.

This enumeration lists the digitiser types that can be determined from a GCF block header. This information can be extracted if the extended sysid bit is set.

Enumerator
gcf_digitiser_unknown 

Unknown (probably, but not necessarily, CMG-DM24mk2).

gcf_digitiser_dm24mk3 

CMG-DM24mk3.

gcf_digitiser_cd24 

CMG-CD24.

gcf_digitiser_das 

CMG-DAS (next generation digitiser).

◆ gcf_variable_gain_t

Possible variable gain values.

This enumeration lists the values for the variable gain setting. There may be no gain front end fitted in which case the value would be gcf_no_variable_gain otherwise it indicates the value.

Enumerator
gcf_no_variable_gain 

No gain front end fitted.

gcf_variable_gain_times_one 

Variable gain times 1.

gcf_variable_gain_times_two 

Variable gain times 2.

gcf_variable_gain_times_four 

Variable gain times 4.

gcf_variable_gain_times_eight 

Variable gain times 8.

gcf_variable_gain_times_sixteen 

Variable gain times 16.

gcf_variable_gain_times_thirtytwo 

Variable gain times 32.

gcf_variable_gain_times_sixtyfour 

Variable gain times 64.

◆ gcf_sample_format_t

Possible sample formats.

This enumeration lists the possible sample formats for a data block.

Enumerator
gcf_sample_format_32bit_diff 

32-bit differences.

gcf_sample_format_24bit_diff_mod 

24-bit differences, modulo 0xFFFFFF.

gcf_sample_format_16bit_diff 

16-bit differences.

gcf_sample_format_8bit_diff 

8-bit differences.

Function Documentation

◆ gcf_parse_hdr()

int gcf_parse_hdr ( const char *  data,
int  len,
union gcf_union_hdr hdr 
)

Parse header.

Parameters
dataBlock data.
lenBlock length.
[out]hdrHeader union into which parsed header data will be written.
Return values
0on success.
-1on error (and see gcf_errstr).

This function will parse a GCF block header. It will only access the first 16 bytes of data, regardless of the specified len. len is used to determine if the data is in the special 24-bit difference mode used by the DM24mk3 over BRP; it is also used to ensure that the block contains enough data for the given number of samples. If the block was not transmitted using a protocol which truncates partially used blocks, then len should be set to 1024.

If the block header is invalid, then -1 is returned; otherwise, the parsed header data is valid and 0 is returned. On error, an informative message is written to gcf_errstr.