You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
91 lines
2.3 KiB
C++
91 lines
2.3 KiB
C++
/*****************************************************************************
|
|
* steim1.h
|
|
*
|
|
* Steim1 encoder
|
|
*
|
|
* (c) 2000 Andres Heinloo, GFZ Potsdam
|
|
*
|
|
* 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, or (at your option) any later
|
|
* version. For more information, see http://www.gnu.org/
|
|
*
|
|
* ================
|
|
* Change log
|
|
* ===============
|
|
*
|
|
* 01.01.2013 Adapted code to CAPS client library requirements (gempa GmbH)
|
|
*****************************************************************************/
|
|
|
|
#ifndef CAPS_MSEED_STEIM1_H
|
|
#define CAPS_MSEED_STEIM1_H
|
|
|
|
#include "encoder.h"
|
|
#include "mseed.h"
|
|
|
|
|
|
namespace Gempa {
|
|
namespace CAPS {
|
|
|
|
|
|
//*****************************************************************************
|
|
// Steim1Frame
|
|
//*****************************************************************************
|
|
|
|
struct Steim1Frame {
|
|
u_int32_t nibble_word;
|
|
u_int32_t sample_word[15];
|
|
};
|
|
|
|
//*****************************************************************************
|
|
// Steim1Encoder
|
|
//*****************************************************************************
|
|
|
|
template<typename T>
|
|
class Steim1Encoder: public Encoder {
|
|
private:
|
|
MSEEDFormat *format;
|
|
int frame_count;
|
|
int bp;
|
|
int fp;
|
|
int spw;
|
|
int32_t last_sample;
|
|
int32_t buf[5];
|
|
u_int32_t nibble_word;
|
|
MSEEDEncoderPacket<Steim1Frame> current_packet;
|
|
|
|
void update_spw(int bp);
|
|
void store(int32_t value);
|
|
void init_packet();
|
|
void finish_packet();
|
|
void update_packet();
|
|
|
|
MSEEDEncoderPacket<Steim1Frame> get_packet() {
|
|
return format->get_packet<Steim1Frame>(_clk.get_time(bp),
|
|
_clk.correction(), _timingQuality);
|
|
}
|
|
|
|
void queue_packet(MSEEDEncoderPacket<Steim1Frame> &pckt);
|
|
|
|
int number_of_frames(const MSEEDEncoderPacket<Steim1Frame> &packet) {
|
|
return (packet.datalen >> 6);
|
|
}
|
|
|
|
public:
|
|
Steim1Encoder(MSEEDFormat *format, int freqn, int freqd)
|
|
: Encoder(freqn, freqd), format(format), frame_count(0),
|
|
bp(0), fp(0), spw(4), last_sample(0), nibble_word(0) {}
|
|
virtual ~Steim1Encoder();
|
|
virtual void flush();
|
|
virtual void push(void *value);
|
|
virtual int type() const { return DE_STEIM1; }
|
|
};
|
|
|
|
|
|
}
|
|
}
|
|
|
|
#include "steim1.ipp"
|
|
|
|
#endif // __STEIM1_H__
|