libdata-strong-motion
1.0.1
|
Macros | |
#define | STRONG_MOTION_HORIZONTAL_RESULTANT 'h' |
Special component: 2D (horizontal) resultant. | |
#define | STRONG_MOTION_3D_RESULTANT 'a' |
Special component: 3D resultant. | |
Enumerations | |
enum | strong_motion_tag_t { strong_motion_tag_windowed_mma , strong_motion_tag_pga , strong_motion_tag_rms , strong_motion_tag_correlation , strong_motion_tag_si } |
Tag type. More... | |
enum | strong_motion_inst_t { strong_motion_inst_0 , strong_motion_inst_1 , strong_motion_inst_both } |
Source instrument. More... | |
Functions | |
int | strong_motion_read_tag (const char *st, enum strong_motion_tag_t *type, enum strong_motion_inst_t *inst, char *component, int *nwords) |
Interpret a 32-bit strong motion packet tag. More... | |
Strong motion blocks contain tagged packets. Each packet has a 32-bit tag which gives details of the packet type, the component or components it is from, and the number of data words. This mechanism allows for forward compatibility and allows unknown packets to be skipped.
enum strong_motion_tag_t |
enum strong_motion_inst_t |
int strong_motion_read_tag | ( | const char * | st, |
enum strong_motion_tag_t * | type, | ||
enum strong_motion_inst_t * | inst, | ||
char * | component, | ||
int * | nwords | ||
) |
Interpret a 32-bit strong motion packet tag.
st | Strong motion packet data. | |
[out] | type | Packet type represented by the tag is written here. May be 0. |
[out] | inst | Which instrument the result comes from is written here. May be 0. |
[out] | component | Which component the result comes from is written here, as a single character. May be 0. |
[out] | nwords | Number of data words is written here. |
0 | on success. |
-1 | on error (but nwords still valid). |
Interprets a 32-bit tag at st, writing the results into type, inst, component and nwords (if they are not 0), returning 0 on success or -1 on error.
An error will occur if the tag type or component code is unrecognised, or if the tag type is recognised but the number of data words is not what is expected. In this case, the correct value will nevertheless be written to nwords (if it is not null). This allows unrecognised tags to be skipped.
The component code will only be set if inst is not strong_motion_inst_both. It is a pointer to a single character, which will be set to '0'–'9' or 'A'–'Z' for the corresponding digitiser component (usually 'Z'/'N'/'E'), or to the special values 'h' or 'a' (STRONG_MOTION_HORIZONTAL_RESULTANT and STRONG_MOTION_3D_RESULTANT respectively) for resolved values.