This function reads the header of a SeaSonde CS File Version 6. It sequentially reads blocks based on the provided specifications and returns the read data.
Arguments
- specs
A list of specifications for reading the file header. It should contain three main elements:
nCS6ByteSize
,block_spec
, andblocks
, each containing further specifications for reading various parts of the header.- connection
A connection object to the SeaSonde CS file.
- endian
The byte order for reading the file. Default is "big".
- prev_data
Previous data, if any, that might affect the current reading. Default is NULL.
Condition Management
This function utilizes the rlang
package to manage conditions and provide detailed and structured condition messages:
Condition Classes:
seasonder_v6_block_transformacion_skipped
: Triggered when a transformation for a specific block is skipped.seasonder_v6_transform_function_error
: Triggered when there's an error while applying the transformation function for a V6 header block.seasonder_v6_skip_block_error
: Triggered when there's an error while skipping a block.
Condition Cases:
The following are the scenarios when errors or conditions are raised:
Transformation Failure: If there's a recognized block key and the transformation function associated with it fails.
Error in Transformation Function Application: If there's an error while applying the transformation function for a recognized V6 header block.
Error in Skipping Block: If there's an error while skipping a block when the block key is not recognized.
Restart Options:
The function provides the following restart option:
seasonder_v6_skip_transformation
: This restart allows users to skip the transformation for a specific block and instead return the provided value.
Effects of Restart Options:
Using the seasonder_v6_skip_transformation
restart:
The error message gets logged.
The transformation that caused the error gets skipped.
The provided value for that block is returned.
Proper error management ensures the integrity of the reading process and provides detailed feedback to users regarding issues and potential resolutions.