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.

70 lines
2.5 KiB
C++

/***************************************************************************
* Copyright (C) 2016 by gempa GmbH *
* *
* All Rights Reserved. *
* *
* NOTICE: All information contained herein is, and remains *
* the property of gempa GmbH and its suppliers, if any. The intellectual *
* and technical concepts contained herein are proprietary to gempa GmbH *
* and its suppliers. *
* Dissemination of this information or reproduction of this material *
* is strictly forbidden unless prior written permission is obtained *
* from gempa GmbH. *
***************************************************************************/
#ifndef GEMPA_CAPS_PLUGINPACKET_H
#define GEMPA_CAPS_PLUGINPACKET_H
#include "mseed/encoder.h"
namespace Gempa {
namespace CAPS {
struct Packet {
Packet() : timingQuality(-1) {}
Packet(DataRecordPtr rec,
const std::string &networkCode, const std::string &stationCode,
const std::string &locationCode, const std::string &channelCode)
: record(rec), networkCode(networkCode), stationCode(stationCode),
locationCode(locationCode), channelCode(channelCode), timingQuality(-1) {
streamID = networkCode + "." + stationCode + "." +
locationCode + "." + channelCode;
}
Packet* clone() {
Packet *packet = new Packet(record, networkCode, stationCode,
locationCode, channelCode);
packet->buffer = buffer;
packet->dt_us = dt_us;
packet->streamID = streamID;
return packet;
}
typedef std::vector<char> Buffer;
typedef boost::shared_ptr<Buffer> BufferPtr;
BufferPtr buffer; // PacketDataHeader, PacketHeader[V1|V2], Data
DataRecordPtr record;
std::string networkCode;
std::string stationCode;
std::string locationCode;
std::string channelCode;
std::string streamID;
DataType dataType;
#if !defined(CAPS_FEATURES_BACKFILLING) || CAPS_FEATURES_BACKFILLING
int64_t dt_us; // Length of one sample in microseconds
#endif
std::string uom;
int timingQuality;
size_t size() const { return buffer->size(); }
};
typedef boost::shared_ptr<Packet> PacketPtr;
}
}
#endif