Files
libcapsclient/libs/gempa/caps/rtcm2packet.h
2026-03-18 15:18:05 +01:00

111 lines
3.1 KiB
C++

/***************************************************************************
* Copyright (C) 2012 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_RTCM2PACKET_H
#define GEMPA_CAPS_RTCM2PACKET_H
#include <gempa/caps/endianess.h>
#include <gempa/caps/packet.h>
namespace Gempa {
namespace CAPS {
class RTCM2DataRecord : public DataRecord {
public:
struct RTCM2Header : Header {
bool get(std::streambuf &buf) {
Endianess::Reader get(buf);
get(samplingTime.year);
get(samplingTime.yday);
get(samplingTime.hour);
get(samplingTime.minute);
get(samplingTime.second);
get(samplingTime.usec);
get(samplingFrequencyNumerator);
get(samplingFrequencyDenominator);
return get.good;
}
bool put(std::streambuf &buf) const;
// size of data header
int dataSize() const {
return
sizeof(samplingTime.year) +
sizeof(samplingTime.yday) +
sizeof(samplingTime.hour) +
sizeof(samplingTime.minute) +
sizeof(samplingTime.second) +
sizeof(samplingTime.usec) +
sizeof(samplingFrequencyNumerator) +
sizeof(samplingFrequencyDenominator);
}
};
RTCM2DataRecord();
DataRecord *clone() const override;
const char* formatName() const override;
void setTimeStamp(const Time &ts);
void setSamplingFrequency(uint16_t numerator, uint16_t denominator);
bool readMetaData(std::streambuf &buf, int size,
Header &header,
Time &startTime,
Time &endTime) override;
const Header *header() const override;
Time startTime() const override;
Time endTime() const override;
bool canTrim() const override;
bool canMerge() const override;
bool trim(const Time &start,
const Time &end) const override;
size_t dataSize(bool withHeader) const override;
ReadStatus get(std::streambuf &buf, int size,
const Time &start,
const Time &end,
int maxSize = -1) override;
bool put(std::streambuf &buf, bool withHeader) const override;
PacketType packetType() const override { return RTCM2Packet; }
private:
RTCM2Header _header;
Buffer _data;
Time _startTime;
Time _endTime;
};
}
}
#endif