-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
396 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,6 +95,7 @@ | |
boxfort | ||
clang-tools | ||
criterion | ||
gdb | ||
jq | ||
libffi | ||
libgit2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,77 @@ | ||
/** | ||
* @file | ||
* @author Philipp Jungkamp <[email protected]> | ||
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC | ||
* @license Apache 2.0 | ||
*********************************************************************************/ | ||
/* Node type: C37-118. | ||
* | ||
* Author: Philipp Jungkamp <[email protected]> | ||
* SPDX-FileCopyrightText: 2014-2024 Institute for Automation of Complex Power Systems, RWTH Aachen University | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <cstdint> | ||
#include <string> | ||
#include <optional> | ||
#include <villas/nodes/c37_118/parser.hpp> | ||
#include <villas/node/config.hpp> | ||
#include <variant> | ||
#include <vector> | ||
#include <villas/node.hpp> | ||
#include <villas/node/config.hpp> | ||
#include <villas/nodes/c37_118/parser.hpp> | ||
#include <villas/queue_signalled.h> | ||
#include <villas/signal.hpp> | ||
#include <villas/socket_addr.hpp> | ||
#include <villas/timing.hpp> | ||
|
||
namespace villas { | ||
namespace node { | ||
namespace c37_118 { | ||
namespace villas::node::c37_118 { | ||
|
||
class C37_118 : public Node { | ||
protected: | ||
struct Input { | ||
std::string address; | ||
} input; | ||
using parser::Parser; | ||
using types::Frame; | ||
using types::Config; | ||
|
||
virtual | ||
int _read(struct Sample *smps[], unsigned cnt) override; | ||
class C37_118 final : public Node { | ||
private: | ||
struct Server { | ||
std::string addr; | ||
uint16_t port; | ||
int socktype; | ||
Config config; | ||
|
||
public: | ||
C37_118(const std::string &name = ""); | ||
int listener_fd; | ||
std::vector<int> connection_fds; | ||
}; | ||
|
||
struct Client { | ||
std::string addr; | ||
uint16_t port; | ||
uint16_t idcode; | ||
int socktype; | ||
|
||
virtual | ||
~C37_118() override; | ||
std::optional<Config> config; | ||
int connection_fd; | ||
std::vector<unsigned char> recv_buf = std::vector<unsigned char>(1024); | ||
Parser parser; | ||
|
||
virtual | ||
int parse(json_t *json, const uuid_t sn_uuid) override; | ||
void send(Frame::Variant message, timespec ts = time_now()); | ||
std::optional<Frame> recv(); | ||
}; | ||
|
||
virtual | ||
int start() override; | ||
std::variant<Server, Client> role; | ||
|
||
void parseServer(json_t *json); | ||
void parseClient(json_t *json); | ||
|
||
void prepareServer(Server &server); | ||
void prepareClient(Client &client); | ||
|
||
virtual int _read(struct Sample *smps[], unsigned cnt) override; | ||
|
||
public: | ||
C37_118(const uuid_t &id = {}, const std::string &name = "") : Node{id, name} {} | ||
|
||
virtual | ||
int stop() override; | ||
virtual ~C37_118() override; | ||
virtual int parse(json_t *json) override; | ||
virtual int prepare() override; | ||
virtual int start() override; | ||
virtual int stop() override; | ||
virtual std::vector<int> getPollFDs() override; | ||
}; | ||
|
||
} /* namespace c37_118 */ | ||
} /* namespace node */ | ||
} /* namespace villas */ | ||
} // namespace villas::node::c37_118 |
Oops, something went wrong.