85 lines
2.5 KiB
C++
85 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 "packet.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,
|
|
void *context = nullptr)
|
|
: record(rec)
|
|
, networkCode(networkCode)
|
|
, stationCode(stationCode)
|
|
, locationCode(locationCode)
|
|
, channelCode(channelCode)
|
|
, timingQuality(-1)
|
|
, context(context)
|
|
{
|
|
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;
|
|
}
|
|
|
|
using Buffer = std::vector<char>;
|
|
using BufferPtr = boost::shared_ptr<Buffer>;
|
|
|
|
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;
|
|
void *context;
|
|
|
|
size_t size() const { return buffer->size(); }
|
|
};
|
|
|
|
|
|
using PacketPtr = boost::shared_ptr<Packet>;
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
#endif
|