Falcon
Loading...
Searching...
No Matches
openephysZMQ.hpp
1// ---------------------------------------------------------------------
2// This file is part of falcon-core.
3//
4// Copyright (C) 2021 - present Neuro-Electronics Research Flanders
5//
6// Falcon-server is free software: you can redistribute it and/or modify
7// it under the terms of the GNU General Public License as published by
8// the Free Software Foundation, either version 3 of the License, or
9// (at your option) any later version.
10//
11// Falcon-server is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15//
16// You should have received a copy of the GNU General Public License
17// along with falcon-core. If not, see <http://www.gnu.org/licenses/>.
18// ---------------------------------------------------------------------
19
20#pragma once
21
22#include "channel_generated.h"
23#include "flatbuffers/flatbuffers.h"
24#include "iprocessor.hpp"
25#include "timeseriesdata/timeseriesdata.hpp"
26#include "utilities/zmqutil.hpp"
27
28class OpenEphysZMQ : public IProcessor {
29 // CONSTRUCTOR and OVERLOADED METHODS
30 public:
31 OpenEphysZMQ();
32 void Preprocess(ProcessingContext& context) override;
33 void CreatePorts() override;
34 void CompleteStreamInfo() override;
35 void Process(ProcessingContext& context) override;
36 void Postprocess(ProcessingContext& context) override;
37
38 protected:
39 // OPTIONS
40 options::String address_{"127.0.0.1", options::notempty<std::string>()};
41 options::Value<unsigned int, false> port_{5556, options::positive<unsigned int>(true)};
42 options::Value<std::uint64_t, false> npackets_{0, options::zeroismax<std::uint64_t>()};
43 options::Value<unsigned int, false> batch_size_{1};
44 options::Value<unsigned int, false> nchannels_{384, options::positive<unsigned int>(true)};
45
46 // PORT
47 protected:
49
50 // VARIABLES
51 protected:
52 zmq::socket_t socket_;
53
54 uint64_t last_message_number_;
55 uint64_t missing_packets_counter_;
56 uint64_t valid_packets_counter_;
57 uint64_t invalid_packets_counter_;
58 TimePoint first_valid_packet_arrival_time_;
59
60 flatbuffers::FlatBufferBuilder flatbuilder_;
61 openephysflatbuffer::ContinuousDataBuilder builder_;
62};
Definition streamports.hpp:98
Definition runinfo.hpp:248