#include "brttpkt.h" PktRepackage *pktrepackage_create (double twin, char *suffix, char *subcode, int orb, int (*flush_callback) (void *user_data), void *flush_callback_user_data) int pktrepackage_put (PktRepackage *buf, char *net, char *sta, char *chan, char *loc, double time, double dt, double calib, double calper, char *segtype, int nsamp, int *data, int isfloat) int pktrepackage_put_pktchan (PktRepackage *buf, PktChannel *pktchan) int pktrepackage_flush (PktRepackage *buf)
pktrepackage_create creates a new PktRepackage object and returns a pointer to the object instance. This pointer is used as a handle for subsequent operations. The output packets will nominally be twin seconds in duration. The output packets will have format specified by suffix which will also appear in the ORB srcname. An additional srcname subcode can be specified by subcode. The output packets are written to the ORB specified by orb which should be previously opened for writing. flush_callback specifies an optional (NULL for no callback) user callback function that is called whenever a buffer is full and needs to be flushed to the output ORB. The callback function is called with the following syntax:
int flush_callback (void *userdata)
The private pointer passed to pktrepackage_create, flush_callback_user_data, is passed back to flush_callback.
pktrepackage_put will put a single continguous channel of waveform data into the buffer specified by buf. net, sta, chan and loc are the SEED codes associated with the waveform segment. time, samprate, nsamp, calib, calper and segtype are the same as those fields in the PktChannel structure. The waveform data array is specified by data, which is normally of type int. If data is in 4-byte floating format, then the isfloat flag must be set.
pktrepackage_put_pktchan will put a single continguous channel of waveform data into the buffer specified by buf. This is a convenience routine when the data is already contained within a PktChannel structure, specified by pktchan.
pktrepackage_flush will force flushing of the buffer specified by buf. This will cause any data not already pushed to the output ORB to be immediately written even if the current ORB packet buffer is not full.
Everything else returns 0 if OK or -1 if there is an error. If there is an error, then messages are left on the error register.