Skip to content

Commit

Permalink
rebranding and updating
Browse files Browse the repository at this point in the history
  • Loading branch information
tanneberger committed Dec 29, 2022
1 parent 24ba439 commit e49f2f4
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 44 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Service which filters and sends out data to all listening clients over websocket

- **GRPC_PORT**: mendatory under which the grpc server runs
- **WEBSOCKET_PORT**: mendatory under which port the websocket port runs
- **API_DOMAIN**: http domain of an running [dvb-api](https://github.com/dump-dvb/dvb-api)
- **API_DOMAIN**: http domain of an running [state-api](https://github.com/tlm-solutions/state-api)

### Filter

Expand Down
6 changes: 3 additions & 3 deletions derivation.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
prometheus-cpp,
grpc,
which,
dump-dvb-rust,
tlms-rust,
curlpp,
curlFull,
json-structs-src
Expand Down Expand Up @@ -44,7 +44,7 @@ stdenv.mkDerivation {
phases = [ "unpackPhase" "buildPhase" "installPhase" ];

buildPhase = ''
cp ${dump-dvb-rust}/proto/telegram.proto ./telegram.proto
cp ${tlms-rust}/proto/telegram.proto ./telegram.proto
mkdir -p src/protobuf
protoc -I ./ --grpc_out=./src/protobuf/ --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` ./telegram.proto
protoc -I=./ --cpp_out=./src/protobuf/ ./telegram.proto
Expand All @@ -63,6 +63,6 @@ stdenv.mkDerivation {

meta = with lib; {
description = "service which takes the incoming data";
homepage = "https://github.com/dump-dvb/funnel";
homepage = "https://github.com/tlm-solutions/funnel";
};
}
46 changes: 23 additions & 23 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
url = "github:numtide/flake-utils";
};

dump-dvb-rust = {
url = "github:dump-dvb/dump-dvb.rs";
tlms-rust = {
url = "github:tlm-solutions/tlms.rs";
flake = false;
};

Expand All @@ -17,15 +17,14 @@
};
};

outputs = { self, nixpkgs, utils, dump-dvb-rust, json-structs, ... }:
outputs = { self, nixpkgs, utils, tlms-rust, json-structs, ... }:
(utils.lib.eachDefaultSystem
(system:
let
pkgs = nixpkgs.legacyPackages.${system};

package = pkgs.callPackage ./derivation.nix {
#stdenv = pkgs.clang13Stdenv;
dump-dvb-rust = dump-dvb-rust;
tlms-rust = tlms-rust;
json-structs-src = json-structs;
};
in
Expand Down
8 changes: 4 additions & 4 deletions src/broadcast_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ void BroadcastServer::process_messages() noexcept {
}

auto BroadcastServer::fetch_api(unsigned int line, unsigned int run, unsigned int region) const noexcept
-> dvbdump::Edge * {
-> tlms::Edge * {
if (!api_url_.has_value()) {
return nullptr;
}
Expand Down Expand Up @@ -191,7 +191,7 @@ auto BroadcastServer::fetch_api(unsigned int line, unsigned int run, unsigned in
google::protobuf::util::JsonParseOptions parse_options;
parse_options.case_insensitive_enum_parsing = false;
parse_options.ignore_unknown_fields = true;
auto *interpolation_struct = new dvbdump::Edge();
auto *interpolation_struct = new tlms::Edge();

auto status = google::protobuf::util::JsonStringToMessage(protobuf_string, interpolation_struct, parse_options);

Expand All @@ -206,7 +206,7 @@ auto BroadcastServer::fetch_api(unsigned int line, unsigned int run, unsigned in
}
}

void BroadcastServer::queue_telegram(const dvbdump::R09GrpcTelegram *telegram) noexcept {
void BroadcastServer::queue_telegram(const tlms::R09GrpcTelegram *telegram) noexcept {
// serialize the protobuf struct into json string
std::string plain_serialized;
plain_serialized.reserve(400);
Expand All @@ -223,7 +223,7 @@ void BroadcastServer::queue_telegram(const dvbdump::R09GrpcTelegram *telegram) n
auto interpolation_data = fetch_api(telegram->line(), telegram->run_number(), telegram->region());

bool enrichment_possible = interpolation_data != nullptr;
dvbdump::R09GrpcTelegramEnriched enriched_telegram;
tlms::R09GrpcTelegramEnriched enriched_telegram;
if (enrichment_possible) {
enriched_telegram.set_time(telegram->time());
enriched_telegram.set_station(telegram->station());
Expand Down
4 changes: 2 additions & 2 deletions src/broadcast_server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ class BroadcastServer {
void on_close(connection_hdl hdl) noexcept;
void on_message(connection_hdl hdl, server::message_ptr msg) noexcept;
void process_messages() noexcept;
void queue_telegram(const dvbdump::R09GrpcTelegram* telegram) noexcept;
void queue_telegram(const tlms::R09GrpcTelegram* telegram) noexcept;
void kill() noexcept;
auto fetch_api(unsigned int line, unsigned int run, unsigned int region) const noexcept -> dvbdump::Edge*;
auto fetch_api(unsigned int line, unsigned int run, unsigned int region) const noexcept -> tlms::Edge*;
};

#endif //FUNNEL_BROADCAST_SERVER_HPP
Expand Down
4 changes: 2 additions & 2 deletions src/receives_telegrams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ ReceivesTelegramsImpl::~ReceivesTelegramsImpl() noexcept {
}

auto ReceivesTelegramsImpl::receive_r09([[maybe_unused]]grpc::ServerContext *context,
const dvbdump::R09GrpcTelegram *telegram,
dvbdump::ReturnCode *return_code) noexcept -> grpc::Status {
const tlms::R09GrpcTelegram *telegram,
tlms::ReturnCode *return_code) noexcept -> grpc::Status {
this->websocket_server_.queue_telegram(telegram);
return_code->set_status(0);
return grpc::Status::OK;
Expand Down
6 changes: 3 additions & 3 deletions src/receives_telegrams.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <grpcpp/server_builder.h>
#include <grpcpp/server_context.h>

class ReceivesTelegramsImpl final : public dvbdump::ReceivesTelegrams::Service {
class ReceivesTelegramsImpl final : public tlms::ReceivesTelegrams::Service {
private:
BroadcastServer websocket_server_;
std::thread message_processor_;
Expand All @@ -26,8 +26,8 @@ class ReceivesTelegramsImpl final : public dvbdump::ReceivesTelegrams::Service {
explicit ReceivesTelegramsImpl(unsigned short websocket_port) noexcept;
~ReceivesTelegramsImpl() noexcept override;

auto receive_r09(grpc::ServerContext *context, const dvbdump::R09GrpcTelegram *telegram,
dvbdump::ReturnCode *return_code) noexcept -> grpc::Status override;
auto receive_r09(grpc::ServerContext *context, const tlms::R09GrpcTelegram *telegram,
tlms::ReturnCode *return_code) noexcept -> grpc::Status override;
};

#endif //FUNNEL_RECEIVES_TELEGRAMS_HPP
3 changes: 2 additions & 1 deletion test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ async def hello(uri):
data = json.loads(await websocket.recv())
print(data)

asyncio.run(hello("wss://socket.staging.dvb.solutions"))
#TODO: change this to new domain
asyncio.run(hello("wss://socket.dvb.solutions"))
#asyncio.run(hello("ws://127.0.0.1:9001"))

0 comments on commit e49f2f4

Please sign in to comment.